|
||||||||||
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,
java.lang.Object contextBean)
Create a new JXPathContextReferenceImpl. |
|
JXPathContextReferenceImpl(JXPathContext parentContext,
java.lang.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 java.lang.Object |
allocateConditionally(java.lang.String className,
java.lang.String existenceCheckClassName)
Checks if existenceCheckClass exists on the class path. |
protected CompiledExpression |
compilePath(java.lang.String xpath)
Overridden by each concrete implementation of JXPathContext to perform compilation. |
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 JXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory) . |
Pointer |
createPath(java.lang.String xpath,
Expression expr)
Create the given path. |
Pointer |
createPathAndSetValue(java.lang.String xpath,
Expression expr,
java.lang.Object value)
Create the given path setting its value to 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 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,
java.lang.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. |
java.lang.String |
getNamespaceURI(java.lang.String prefix)
Given a prefix, returns a registered namespace URI. |
static NodePointerFactory[] |
getNodePointerFactories()
Get the registered NodePointerFactories. |
Pointer |
getPointer(java.lang.String xpath)
Traverses the xpath and returns a Pointer. |
Pointer |
getPointer(java.lang.String xpath,
Expression expr)
Get a pointer to the specified path/expression. |
java.lang.String |
getPrefix(java.lang.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. |
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)
Get the value indicated. |
java.lang.Object |
getValue(java.lang.String xpath,
Expression expr,
java.lang.Class requiredType)
Get the value indicated. |
NodePointer |
getVariablePointer(QName name)
Get a VariablePointer for the given variable 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)
Traverses the xpath and returns a Iterator of all results found for the path. |
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)
Traverses the xpath and returns an Iterator of Pointers. |
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)
Remove all matching nodes. |
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)
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(java.lang.String xpath,
Expression expr,
java.lang.Object value)
Set the value of xpath to value. |
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, 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, java.lang.Object contextBean)
parentContext
- parent contextcontextBean
- Objectpublic JXPathContextReferenceImpl(JXPathContext parentContext, java.lang.Object contextBean, Pointer contextPointer)
parentContext
- parent contextcontextBean
- ObjectcontextPointer
- context pointerMethod Detail |
---|
public static void addNodePointerFactory(NodePointerFactory factory)
factory
- NodePointerFactory to addpublic static NodePointerFactory[] getNodePointerFactories()
protected Compiler getCompiler()
protected CompiledExpression compilePath(java.lang.String xpath)
JXPathContext
compile()
.
compilePath
in class JXPathContext
xpath
- to compile
public java.lang.Object getValue(java.lang.String xpath)
getValue
in class JXPathContext
xpath
- expression
public java.lang.Object getValue(java.lang.String xpath, Expression expr)
xpath
- Stringexpr
- Expression
public java.lang.Object getValue(java.lang.String xpath, java.lang.Class requiredType)
getValue
in class JXPathContext
xpath
- expressionrequiredType
- Class
public java.lang.Object getValue(java.lang.String xpath, Expression expr, java.lang.Class requiredType)
xpath
- expressionexpr
- compiled ExpressionrequiredType
- Class
public java.util.Iterator iterate(java.lang.String xpath)
iterate
in class JXPathContext
xpath
- expression
public java.util.Iterator iterate(java.lang.String xpath, Expression expr)
xpath
- expressionexpr
- compiled Expression
public Pointer getPointer(java.lang.String xpath)
JXPathContext
getPointer
in class JXPathContext
xpath
- desired
public Pointer getPointer(java.lang.String xpath, Expression expr)
xpath
- Stringexpr
- compiled Expression
public void setValue(java.lang.String xpath, java.lang.Object value)
JXPathContext
setValue
in class JXPathContext
xpath
- indicating positionvalue
- to setpublic void setValue(java.lang.String xpath, Expression expr, java.lang.Object value)
xpath
- pathexpr
- compiled Expressionvalue
- Objectpublic Pointer createPath(java.lang.String xpath)
JXPathContext
AbstractFactory
,
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 JXPathContext
xpath
- indicating destination to create
public Pointer createPath(java.lang.String xpath, Expression expr)
xpath
- Stringexpr
- compiled Expression
public Pointer createPathAndSetValue(java.lang.String xpath, java.lang.Object value)
JXPathContext
AbstractFactory
, 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 JXPathContext
xpath
- indicating position to createvalue
- to set
public Pointer createPathAndSetValue(java.lang.String xpath, Expression expr, java.lang.Object value)
xpath
- Stringexpr
- compiled Expressionvalue
- Object
public java.util.Iterator iteratePointers(java.lang.String xpath)
iteratePointers
in class JXPathContext
xpath
- expression
public java.util.Iterator iteratePointers(java.lang.String xpath, Expression expr)
xpath
- expressionexpr
- compiled Expression
public void removePath(java.lang.String xpath)
JXPathContext
removePath
in class JXPathContext
xpath
- indicating position to removepublic void removePath(java.lang.String xpath, Expression expr)
xpath
- expressionexpr
- compiled Expressionpublic void removeAll(java.lang.String xpath)
JXPathContext
removeAll
in class JXPathContext
xpath
- indicating positions to removepublic void removeAll(java.lang.String xpath, Expression expr)
xpath
- expressionexpr
- compiled Expressionpublic JXPathContext getRelativeContext(Pointer pointer)
JXPathContext
getRelativeContext
in class JXPathContext
pointer
- Pointer
public Pointer getContextPointer()
JXPathContext
getContextPointer
in class JXPathContext
public EvalContext getAbsoluteRootContext()
public NodePointer getVariablePointer(QName name)
name
- variable name
public Function getFunction(QName functionName, java.lang.Object[] parameters)
functionName
- nameparameters
- function args
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 java.lang.String getPrefix(java.lang.String namespaceURI)
getPrefix
in class JXPathContext
namespaceURI
- the ns URI to check.
JXPathContext.getPrefix(java.lang.String)
public void setNamespaceContextPointer(Pointer pointer)
JXPathContext
getContextPointer()
setNamespaceContextPointer
in class JXPathContext
pointer
- The pointer to the context where prefixes used in
XPath expressions should be resolved.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)
className
- to instantiateexistenceCheckClassName
- guard class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |