Package org.apache.commons.jxpath
Class JXPathContextFactory
- java.lang.Object
-
- org.apache.commons.jxpath.JXPathContextFactory
-
- Direct Known Subclasses:
JXPathContextFactoryReferenceImpl
public abstract class JXPathContextFactory extends java.lang.Object
Defines a factory API that enables applications to obtain aJXPathContext
instance. To acquire a JXPathContext, first call the staticnewInstance()
method of JXPathContextFactory. This method returns a concrete JXPathContextFactory. Then callnewContext(org.apache.commons.jxpath.JXPathContext, java.lang.Object)
on that instance. You will rarely need to perform these steps explicitly: usually you can call one of theJXPathContex.newContext
methods, which will perform these steps for you.- Version:
- $Revision: 670727 $ $Date: 2008-06-23 15:10:38 -0500 (Mon, 23 Jun 2008) $
- See Also:
JXPathContext.newContext(Object)
,JXPathContext.newContext(JXPathContext,Object)
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
debug
Temp debug code - this will be removed after we test everythingprivate static java.lang.String
DEFAULT_FACTORY_CLASS
The default factory classstatic java.lang.String
FACTORY_NAME_PROPERTY
The default propertyprivate static java.lang.String
factoryImplName
Avoid reading all the files when the findFactory method is called the second time ( cache the result of finding the default impl )
-
Constructor Summary
Constructors Modifier Constructor Description protected
JXPathContextFactory()
Create a new JXPathContextFactory.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
findFactory(java.lang.String property, java.lang.String defaultFactory)
Private implementation method - will find the implementation class in the specified order.abstract JXPathContext
newContext(JXPathContext parentContext, java.lang.Object contextBean)
Creates a new instance of a JXPathContext using the currently configured parameters.static JXPathContextFactory
newInstance()
Obtain a new instance of aJXPathContextFactory
.
-
-
-
Field Detail
-
FACTORY_NAME_PROPERTY
public static final java.lang.String FACTORY_NAME_PROPERTY
The default property- See Also:
- Constant Field Values
-
DEFAULT_FACTORY_CLASS
private static final java.lang.String DEFAULT_FACTORY_CLASS
The default factory class- See Also:
- Constant Field Values
-
factoryImplName
private static java.lang.String 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 debug
Temp debug code - this will be removed after we test everything
-
-
Method Detail
-
newInstance
public static JXPathContextFactory 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 theJXPathContextFactory
implementation class to load:-
Use the
org.apache.commons.jxpath.JXPathContextFactory
system 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. JXPathContextFactory
in jars available to the runtime. -
Platform default
JXPathContextFactory
instance.
JXPathContextFactory
it 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
public abstract JXPathContext newContext(JXPathContext parentContext, java.lang.Object contextBean)
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 static java.lang.String findFactory(java.lang.String property, java.lang.String defaultFactory)
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
-
-