|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.jxpath.JXPathContext
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl
public class JXPathContextReferenceImpl
The reference implementation of JXPathContext.
| Field Summary | |
|---|---|
protected NamespaceResolver |
namespaceResolver
Namespace resolver |
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,
Object contextBean)
Create a new JXPathContextReferenceImpl. |
|
JXPathContextReferenceImpl(JXPathContext parentContext,
Object contextBean,
Pointer contextPointer)
Create a new JXPathContextReferenceImpl. |
| Method Summary | |
|---|---|
static void |
addNodePointerFactory(NodePointerFactory factory)
Call this with a custom NodePointerFactory to add support for additional types of objects. |
static Object |
allocateConditionally(String className,
String existenceCheckClassName)
Checks if existenceCheckClass exists on the class path. |
protected CompiledExpression |
compilePath(String xpath)
Overridden by each concrete implementation of JXPathContext to perform compilation. |
Pointer |
createPath(String xpath)
Creates missing elements of the path by invoking an AbstractFactory,
which should first be installed on the context by calling JXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory). |
Pointer |
createPath(String xpath,
Expression expr)
Create the given path. |
Pointer |
createPathAndSetValue(String xpath,
Expression expr,
Object value)
Create the given path setting its value to value. |
Pointer |
createPathAndSetValue(String xpath,
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 JXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory). |
EvalContext |
getAbsoluteRootContext()
Get the absolute root context. |
protected Compiler |
getCompiler()
Returns a static instance of TreeCompiler. |
Pointer |
getContextPointer()
Returns a Pointer for the context bean. |
Function |
getFunction(QName functionName,
Object[] parameters)
Get the named Function. |
Pointer |
getNamespaceContextPointer()
Returns the namespace context pointer set with setNamespaceContextPointer()
or, if none has been specified, the context pointer otherwise. |
NamespaceResolver |
getNamespaceResolver()
Get the namespace resolver. |
String |
getNamespaceURI(String prefix)
Given a prefix, returns a registered namespace URI. |
static NodePointerFactory[] |
getNodePointerFactories()
Get the registered NodePointerFactories. |
Pointer |
getPointer(String xpath)
Traverses the xpath and returns a Pointer. |
Pointer |
getPointer(String xpath,
Expression expr)
Get a pointer to the specified path/expression. |
String |
getPrefix(String namespaceURI)
Get the prefix associated with the specifed namespace URI. |
JXPathContext |
getRelativeContext(Pointer pointer)
Returns a JXPathContext that is relative to the current JXPathContext. |
Object |
getValue(String xpath)
Traverses the xpath and returns the resulting object. |
Object |
getValue(String xpath,
Class requiredType)
Calls getValue(xpath), converts the result to the required type and returns the result of the conversion. |
Object |
getValue(String xpath,
Expression expr)
Get the value indicated. |
Object |
getValue(String xpath,
Expression expr,
Class requiredType)
Get the value indicated. |
NodePointer |
getVariablePointer(QName name)
Get a VariablePointer for the given variable name. |
Iterator |
iterate(String xpath)
Traverses the xpath and returns a Iterator of all results found for the path. |
Iterator |
iterate(String xpath,
Expression expr)
Traverses the xpath and returns a Iterator of all results found for the path. |
Iterator |
iteratePointers(String xpath)
Traverses the xpath and returns an Iterator of Pointers. |
Iterator |
iteratePointers(String xpath,
Expression expr)
Traverses the xpath and returns an Iterator of Pointers. |
void |
registerNamespace(String prefix,
String namespaceURI)
Registers a namespace prefix. |
void |
removeAll(String xpath)
Removes all elements of the object graph described by the xpath. |
void |
removeAll(String xpath,
Expression expr)
Remove all matching nodes. |
void |
removePath(String xpath)
Removes the element of the object graph described by the xpath. |
void |
removePath(String xpath,
Expression expr)
Remove the specified path. |
void |
setNamespaceContextPointer(Pointer pointer)
Namespace prefixes can be defined implicitly by specifying a pointer to a context where the namespaces are defined. |
void |
setValue(String xpath,
Expression expr,
Object value)
Set the value of xpath to value. |
void |
setValue(String xpath,
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, getNodeSetByKey, 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.
protected NamespaceResolver namespaceResolver
| Constructor Detail |
|---|
protected JXPathContextReferenceImpl(JXPathContext parentContext,
Object contextBean)
parentContext - parent contextcontextBean - Object
public JXPathContextReferenceImpl(JXPathContext parentContext,
Object contextBean,
Pointer contextPointer)
parentContext - parent contextcontextBean - ObjectcontextPointer - context pointer| Method Detail |
|---|
public static void addNodePointerFactory(NodePointerFactory factory)
factory - NodePointerFactory to addpublic static NodePointerFactory[] getNodePointerFactories()
protected Compiler getCompiler()
protected CompiledExpression compilePath(String xpath)
JXPathContextcompile().
compilePath in class JXPathContextxpath - to compile
public Object getValue(String xpath)
getValue in class JXPathContextxpath - expression
public Object getValue(String xpath,
Expression expr)
xpath - Stringexpr - Expression
public Object getValue(String xpath,
Class requiredType)
getValue in class JXPathContextxpath - expressionrequiredType - Class
public Object getValue(String xpath,
Expression expr,
Class requiredType)
xpath - expressionexpr - compiled ExpressionrequiredType - Class
public Iterator iterate(String xpath)
iterate in class JXPathContextxpath - expression
public Iterator iterate(String xpath,
Expression expr)
xpath - expressionexpr - compiled Expression
public Pointer getPointer(String xpath)
JXPathContext
getPointer in class JXPathContextxpath - desired
public Pointer getPointer(String xpath,
Expression expr)
xpath - Stringexpr - compiled Expression
public void setValue(String xpath,
Object value)
JXPathContext
setValue in class JXPathContextxpath - indicating positionvalue - to set
public void setValue(String xpath,
Expression expr,
Object value)
xpath - pathexpr - compiled Expressionvalue - Objectpublic Pointer createPath(String xpath)
JXPathContextAbstractFactory,
which should first be installed on the context by calling JXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory).
Will throw an exception if the AbstractFactory fails to create an instance for a path element.
createPath in class JXPathContextxpath - indicating destination to create
public Pointer createPath(String xpath,
Expression expr)
xpath - Stringexpr - compiled Expression
public Pointer createPathAndSetValue(String xpath,
Object value)
JXPathContextAbstractFactory, which should first be
installed on the context by calling JXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory).
Will throw an exception if one of the following conditions occurs:
createPathAndSetValue in class JXPathContextxpath - indicating position to createvalue - to set
public Pointer createPathAndSetValue(String xpath,
Expression expr,
Object value)
xpath - Stringexpr - compiled Expressionvalue - Object
public Iterator iteratePointers(String xpath)
iteratePointers in class JXPathContextxpath - expression
public Iterator iteratePointers(String xpath,
Expression expr)
xpath - expressionexpr - compiled Expression
public void removePath(String xpath)
JXPathContext
removePath in class JXPathContextxpath - indicating position to remove
public void removePath(String xpath,
Expression expr)
xpath - expressionexpr - compiled Expressionpublic void removeAll(String xpath)
JXPathContext
removeAll in class JXPathContextxpath - indicating positions to remove
public void removeAll(String xpath,
Expression expr)
xpath - expressionexpr - compiled Expressionpublic JXPathContext getRelativeContext(Pointer pointer)
JXPathContext
getRelativeContext in class JXPathContextpointer - Pointer
public Pointer getContextPointer()
JXPathContext
getContextPointer in class JXPathContextpublic EvalContext getAbsoluteRootContext()
public NodePointer getVariablePointer(QName name)
name - variable name
public Function getFunction(QName functionName,
Object[] parameters)
functionName - nameparameters - function args
public void registerNamespace(String prefix,
String namespaceURI)
JXPathContext
registerNamespace in class JXPathContextprefix - A namespace prefixnamespaceURI - A URI for that prefixpublic String getNamespaceURI(String prefix)
JXPathContextsetNamespaceContextPointer.
getNamespaceURI in class JXPathContextprefix - The namespace prefix to look up
public String getPrefix(String namespaceURI)
getPrefix in class JXPathContextnamespaceURI - the ns URI to check.
JXPathContext.getPrefix(java.lang.String)public void setNamespaceContextPointer(Pointer pointer)
JXPathContextgetContextPointer()
setNamespaceContextPointer in class JXPathContextpointer - The pointer to the context where prefixes used in
XPath expressions should be resolved.public Pointer getNamespaceContextPointer()
JXPathContextsetNamespaceContextPointer()
or, if none has been specified, the context pointer otherwise.
getNamespaceContextPointer in class JXPathContextpublic NamespaceResolver getNamespaceResolver()
public static Object allocateConditionally(String className,
String existenceCheckClassName)
className - to instantiateexistenceCheckClassName - guard class
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||