Class JXPathContextFactory
java.lang.Object
org.apache.commons.jxpath.JXPathContextFactory
- Direct Known Subclasses:
JXPathContextFactoryReferenceImpl
Defines a factory API that enables applications to obtain a
JXPathContext instance. To acquire a JXPathContext, first call the
static newInstance() method of JXPathContextFactory.
This method returns a concrete JXPathContextFactory.
Then call newContext(JXPathContext, Object) on that instance. You will rarely
need to perform these steps explicitly: usually you can call one of the
JXPathContex.newContext methods, which will perform these steps
for you.- Version:
- $Revision: 670727 $ $Date: 2008-06-23 15:10:38 -0500 (Mon, 23 Jun 2008) $
- Author:
- Dmitri Plotnikov
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static booleanTemp debug code - this will be removed after we test everythingprivate static final StringThe default factory classstatic final StringThe default propertyprivate static StringAvoid reading all the files when the findFactory method is called the second time ( cache the result of finding the default impl ) -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate a new JXPathContextFactory. -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringfindFactory(String property, String defaultFactory) Private implementation method - will find the implementation class in the specified order.abstract JXPathContextnewContext(JXPathContext parentContext, Object contextBean) Creates a new instance of a JXPathContext using the currently configured parameters.static JXPathContextFactoryObtain a new instance of aJXPathContextFactory.
-
Field Details
-
FACTORY_NAME_PROPERTY
-
DEFAULT_FACTORY_CLASS
-
factoryImplName
Avoid reading all the files when the findFactory method is called the second time ( cache the result of finding the default impl ) -
debug
private static boolean debugTemp debug code - this will be removed after we test everything
-
-
Constructor Details
-
JXPathContextFactory
protected JXPathContextFactory()Create a new JXPathContextFactory.
-
-
Method Details
-
newInstance
Obtain a new instance of aJXPathContextFactory. This static method creates a new factory instance. This method uses the following ordered lookup procedure to determine theJXPathContextFactoryimplementation class to load:-
Use the
org.apache.commons.jxpath.JXPathContextFactorysystem property. -
Alternatively, use the JAVA_HOME (the parent directory where jdk is
installed)/lib/jxpath.properties for a property file that contains the
name of the implementation class keyed on
org.apache.commons.jxpath.JXPathContextFactory. -
Use the Services API (as detailed in the JAR specification), if
available, to determine the classname. The Services API will look
for a classname in the file
META- INF/services/org.apache.commons.jxpath. JXPathContextFactoryin jars available to the runtime. -
Platform default
JXPathContextFactoryinstance.
JXPathContextFactoryit can use the factory to obtain JXPathContext instances.- Returns:
- JXPathContextFactory
- Throws:
JXPathContextFactoryConfigurationError- if the implementation is not available or cannot be instantiated.
-
Use the
-
newContext
Creates a new instance of a JXPathContext using the currently configured parameters.- Parameters:
parentContext- parent contextcontextBean- Object bean- Returns:
- JXPathContext
- Throws:
JXPathContextFactoryConfigurationError- if a JXPathContext cannot be created which satisfies the configuration requested
-
findFactory
Private implementation method - will find the implementation class in the specified order.- Parameters:
property- Property namedefaultFactory- Default implementation, if nothing else is found- Returns:
- class name of the JXPathContextFactory
-