Package com.isomorphic.util
Class JXPathContextObjectFactory
java.lang.Object
org.apache.commons.jxpath.AbstractFactory
com.isomorphic.util.JXPathContextObjectFactory
public class JXPathContextObjectFactory extends org.apache.commons.jxpath.AbstractFactory
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
CollectionorList-ArrayListSet-HashSetQueue-LinkedList) 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.