org.apache.commons.jxpath.AbstractFactory
implementation that uses reflection to create missing objects, see related JXPath guide:
Creating objects. Implements
createObject
method and attempts to create what is missing.
The following objects are automatically created if found in the path:
- any Objects with a zero argument constructor
- any Collection. If collection is an interface or abstract type the following concrete classes are used
Collection
or List
- ArrayList
Set
- HashSet
Queue
- LinkedList
Created subobjects are assigned to the index indicated in the path, with null entries added for preceiding indices. Generics must be declared in order to indicate the member type of the Collection (eg List) or auto-creation will not continue past a Collection - any Array - created subobjects are assigned to the index indicated in the path, and other slots are left null. If there is an existing Array that is too short for index indicated in the XPath, a new replacement Array will be created and populated with existing contents plus object newly created by the XPath
NOTE: when assigning to Arrays or Collections by index, remember that in XPath "1" is the index for first element (
NOT 0). Using "1" in an XPath assigns to the first slot, using "0" will raise an IndexOutOfBoundsException.