public interface CompiledExpression
JXPathContext
also globally caches some of the
results of compilation, so the direct use of JXPathContext is not
always less efficient than the use of CompiledExpression.
Use CompiledExpression only when there is a need to evaluate the same expression multiple times and the CompiledExpression can be conveniently cached.
To acquire a CompiledExpression, call JXPathContext.compile
Modifier and Type | Method and Description |
---|---|
Pointer |
createPath(JXPathContext context)
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) . |
Pointer |
createPathAndSetValue(JXPathContext context,
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) . |
Pointer |
getPointer(JXPathContext context,
String xpath)
Traverses the xpath and returns a Pointer.
|
Object |
getValue(JXPathContext context)
Evaluates the xpath and returns the resulting object.
|
Object |
getValue(JXPathContext context,
Class requiredType)
Evaluates the xpath, converts the result to the specified class and
returns the resulting object.
|
Iterator |
iterate(JXPathContext context)
Traverses the xpath and returns a Iterator of all results found
for the path.
|
Iterator |
iteratePointers(JXPathContext context)
Traverses the xpath and returns an Iterator of Pointers.
|
void |
removeAll(JXPathContext context)
Remove all graph elements described by this expression.
|
void |
removePath(JXPathContext context)
Remove the graph element described by this expression.
|
void |
setValue(JXPathContext context,
Object value)
Modifies the value of the property described by the supplied xpath.
|
Object getValue(JXPathContext context)
context
- to evaluateObject getValue(JXPathContext context, Class requiredType)
context
- to evaluaterequiredType
- return typevoid setValue(JXPathContext context, Object value)
context
- basevalue
- to setPointer createPath(JXPathContext context)
AbstractFactory
, which should first be
installed on the context by calling JXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory)
.context
- basePointer createPathAndSetValue(JXPathContext context, Object value)
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:
context
- basevalue
- to setIterator iterate(JXPathContext context)
context
- basePointer getPointer(JXPathContext context, String xpath)
context
- basexpath
- stringIterator iteratePointers(JXPathContext context)
context
- to iteratevoid removePath(JXPathContext context)
context
- basevoid removeAll(JXPathContext context)
context
- baseCopyright © 2001–2015 The Apache Software Foundation. All rights reserved.