|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.jxpath.JXPathContext org.apache.commons.jxpath.ri.JXPathContextReferenceImpl
The reference implementation of JXPathContext.
Field Summary | |
private static int |
CLEANUP_THRESHOLD
|
private static int |
cleanupCount
|
private static java.util.Map |
compiled
|
private static Compiler |
COMPILER
|
private Pointer |
contextPointer
|
protected NamespaceResolver |
namespaceResolver
|
private static java.util.Vector |
nodeFactories
|
private static NodePointerFactory[] |
nodeFactoryArray
|
private Pointer |
rootPointer
|
static boolean |
USE_SOFT_CACHE
Change this to false to disable soft caching of
CompiledExpressions. |
Fields inherited from class org.apache.commons.jxpath.JXPathContext |
contextBean, decimalFormats, factory, functions, idManager, keyManager, parentContext, vars |
Constructor Summary | |
protected |
JXPathContextReferenceImpl(JXPathContext parentContext,
java.lang.Object contextBean)
|
|
JXPathContextReferenceImpl(JXPathContext parentContext,
java.lang.Object contextBean,
Pointer contextPointer)
|
Method Summary | |
static void |
addNodePointerFactory(NodePointerFactory factory)
Call this with a custom NodePointerFactory to add support for additional types of objects. |
static java.lang.Object |
allocateConditionally(java.lang.String className,
java.lang.String existenceCheckClassName)
Checks if existenceCheckClass exists on the class path. |
private void |
checkSimplePath(Expression expr)
Checks if the path follows the JXPath restrictions on the type of path that can be passed to create... |
private Expression |
compileExpression(java.lang.String xpath)
|
protected CompiledExpression |
compilePath(java.lang.String xpath)
Overridden by each concrete implementation of JXPathContext to perform compilation. |
private static void |
createNodeFactoryArray()
|
Pointer |
createPath(java.lang.String xpath)
Creates missing elements of the path by invoking an AbstractFactory, which should first be installed on the context by calling "setFactory". |
Pointer |
createPath(java.lang.String xpath,
Expression expr)
|
Pointer |
createPathAndSetValue(java.lang.String xpath,
Expression expr,
java.lang.Object value)
|
Pointer |
createPathAndSetValue(java.lang.String xpath,
java.lang.Object value)
The same as setValue, except it creates intermediate elements of the path by invoking an AbstractFactory, which should first be installed on the context by calling "setFactory". |
EvalContext |
getAbsoluteRootContext()
|
private NodePointer |
getAbsoluteRootPointer()
|
protected Compiler |
getCompiler()
Returns a static instance of TreeCompiler. |
Pointer |
getContextPointer()
Returns a Pointer for the context bean. |
private EvalContext |
getEvalContext()
|
Function |
getFunction(QName functionName,
java.lang.Object[] parameters)
|
Pointer |
getNamespaceContextPointer()
Returns the namespace context pointer set with setNamespaceContextPointer()
or, if none has been specified, the context pointer otherwise. |
NamespaceResolver |
getNamespaceResolver()
|
java.lang.String |
getNamespaceURI(java.lang.String prefix)
Given a prefix, returns a registered namespace URI. |
static NodePointerFactory[] |
getNodePointerFactories()
|
Pointer |
getPointer(java.lang.String xpath)
Traverses the xpath and returns a Pointer. |
Pointer |
getPointer(java.lang.String xpath,
Expression expr)
|
JXPathContext |
getRelativeContext(Pointer pointer)
Returns a JXPathContext that is relative to the current JXPathContext. |
java.lang.Object |
getValue(java.lang.String xpath)
Traverses the xpath and returns the resulting object. |
java.lang.Object |
getValue(java.lang.String xpath,
java.lang.Class requiredType)
Calls getValue(xpath), converts the result to the required type and returns the result of the conversion. |
java.lang.Object |
getValue(java.lang.String xpath,
Expression expr)
|
java.lang.Object |
getValue(java.lang.String xpath,
Expression expr,
java.lang.Class requiredType)
|
NodePointer |
getVariablePointer(QName name)
|
java.util.Iterator |
iterate(java.lang.String xpath)
Traverses the xpath and returns a Iterator of all results found for the path. |
java.util.Iterator |
iterate(java.lang.String xpath,
Expression expr)
|
java.util.Iterator |
iteratePointers(java.lang.String xpath)
Traverses the xpath and returns an Iterator of Pointers. |
java.util.Iterator |
iteratePointers(java.lang.String xpath,
Expression expr)
|
void |
registerNamespace(java.lang.String prefix,
java.lang.String namespaceURI)
Registers a namespace prefix. |
void |
removeAll(java.lang.String xpath)
Removes all elements of the object graph described by the xpath. |
void |
removeAll(java.lang.String xpath,
Expression expr)
|
void |
removePath(java.lang.String xpath)
Removes the element of the object graph described by the xpath. |
void |
removePath(java.lang.String xpath,
Expression expr)
|
void |
setNamespaceContextPointer(Pointer pointer)
Namespace prefixes can be defined implicitly by specifying a pointer to a context where the namespaces are defined. |
void |
setValue(java.lang.String xpath,
Expression expr,
java.lang.Object value)
|
private Pointer |
setValue(java.lang.String xpath,
Expression expr,
java.lang.Object value,
boolean create)
|
void |
setValue(java.lang.String xpath,
java.lang.Object value)
Modifies the value of the property described by the supplied xpath. |
Methods inherited from class org.apache.commons.jxpath.JXPathContext |
compile, getContextBean, getDecimalFormatSymbols, getFactory, getFunctions, getIdentityManager, getKeyManager, getLocale, getParentContext, getPointerByID, getPointerByKey, getVariables, isLenient, newContext, newContext, selectNodes, selectSingleNode, setDecimalFormatSymbols, setFactory, setFunctions, setIdentityManager, setKeyManager, setLenient, setLocale, setVariables |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean USE_SOFT_CACHE
false
to disable soft caching of
CompiledExpressions.
private static final Compiler COMPILER
private static java.util.Map compiled
private static int cleanupCount
private static java.util.Vector nodeFactories
private static NodePointerFactory[] nodeFactoryArray
private Pointer rootPointer
private Pointer contextPointer
protected NamespaceResolver namespaceResolver
private static final int CLEANUP_THRESHOLD
Constructor Detail |
protected JXPathContextReferenceImpl(JXPathContext parentContext, java.lang.Object contextBean)
public JXPathContextReferenceImpl(JXPathContext parentContext, java.lang.Object contextBean, Pointer contextPointer)
Method Detail |
private static void createNodeFactoryArray()
public static void addNodePointerFactory(NodePointerFactory factory)
public static NodePointerFactory[] getNodePointerFactories()
protected Compiler getCompiler()
protected CompiledExpression compilePath(java.lang.String xpath)
JXPathContext
compile()
.
compilePath
in class JXPathContext
private Expression compileExpression(java.lang.String xpath)
public java.lang.Object getValue(java.lang.String xpath)
getValue
in class JXPathContext
public java.lang.Object getValue(java.lang.String xpath, Expression expr)
public java.lang.Object getValue(java.lang.String xpath, java.lang.Class requiredType)
getValue
in class JXPathContext
public java.lang.Object getValue(java.lang.String xpath, Expression expr, java.lang.Class requiredType)
public java.util.Iterator iterate(java.lang.String xpath)
iterate
in class JXPathContext
public java.util.Iterator iterate(java.lang.String xpath, Expression expr)
public Pointer getPointer(java.lang.String xpath)
JXPathContext
getPointer
in class JXPathContext
public Pointer getPointer(java.lang.String xpath, Expression expr)
public void setValue(java.lang.String xpath, java.lang.Object value)
JXPathContext
setValue
in class JXPathContext
public void setValue(java.lang.String xpath, Expression expr, java.lang.Object value)
public Pointer createPath(java.lang.String xpath)
JXPathContext
Will throw an exception if the AbstractFactory fails to create an instance for a path element.
createPath
in class JXPathContext
public Pointer createPath(java.lang.String xpath, Expression expr)
public Pointer createPathAndSetValue(java.lang.String xpath, java.lang.Object value)
JXPathContext
Will throw an exception if one of the following conditions occurs:
createPathAndSetValue
in class JXPathContext
public Pointer createPathAndSetValue(java.lang.String xpath, Expression expr, java.lang.Object value)
private Pointer setValue(java.lang.String xpath, Expression expr, java.lang.Object value, boolean create)
private void checkSimplePath(Expression expr)
public java.util.Iterator iteratePointers(java.lang.String xpath)
iteratePointers
in class JXPathContext
public java.util.Iterator iteratePointers(java.lang.String xpath, Expression expr)
public void removePath(java.lang.String xpath)
JXPathContext
removePath
in class JXPathContext
public void removePath(java.lang.String xpath, Expression expr)
public void removeAll(java.lang.String xpath)
JXPathContext
removeAll
in class JXPathContext
public void removeAll(java.lang.String xpath, Expression expr)
public JXPathContext getRelativeContext(Pointer pointer)
JXPathContext
getRelativeContext
in class JXPathContext
public Pointer getContextPointer()
JXPathContext
getContextPointer
in class JXPathContext
private NodePointer getAbsoluteRootPointer()
private EvalContext getEvalContext()
public EvalContext getAbsoluteRootContext()
public NodePointer getVariablePointer(QName name)
public Function getFunction(QName functionName, java.lang.Object[] parameters)
public void registerNamespace(java.lang.String prefix, java.lang.String namespaceURI)
JXPathContext
registerNamespace
in class JXPathContext
prefix
- A namespace prefixnamespaceURI
- A URI for that prefixpublic java.lang.String getNamespaceURI(java.lang.String prefix)
JXPathContext
setNamespaceContextPointer
.
getNamespaceURI
in class JXPathContext
prefix
- The namespace prefix to look up
public void setNamespaceContextPointer(Pointer pointer)
JXPathContext
getContextPointer()
setNamespaceContextPointer
in class JXPathContext
public Pointer getNamespaceContextPointer()
JXPathContext
setNamespaceContextPointer()
or, if none has been specified, the context pointer otherwise.
getNamespaceContextPointer
in class JXPathContext
public NamespaceResolver getNamespaceResolver()
public static java.lang.Object allocateConditionally(java.lang.String className, java.lang.String existenceCheckClassName)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |