Package org.apache.commons.jxpath.ri
Class JXPathCompiledExpression
java.lang.Object
org.apache.commons.jxpath.ri.JXPathCompiledExpression
- All Implemented Interfaces:
CompiledExpression
RI of CompiledExpression.
-
Constructor Summary
ConstructorsConstructorDescriptionJXPathCompiledExpression(String xpath, Expression expression) Constructs a new JXPathCompiledExpression. -
Method Summary
Modifier and TypeMethodDescriptioncreatePath(JXPathContext context) Creates intermediate elements of the path by invoking anAbstractFactory, which should first be installed on the context by callingJXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory).createPathAndSetValue(JXPathContext context, Object value) The same as setValue, except it creates intermediate elements of the path by invoking anAbstractFactory, which should first be installed on the context by callingJXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory).protected ExpressionGets the compiled expression.getPointer(JXPathContext context, String xpath) Traverses the XPath and returns a Pointer.getValue(JXPathContext context) Evaluates the XPath and returns the resulting object.getValue(JXPathContext context, Class requiredType) Evaluates the xpath, converts the result to the specified class and returns the resulting object.protected StringgetXPath()Gets the source expression.iterate(JXPathContext context) Traverses the XPath and returns a Iterator of all results found for the path.iteratePointers(JXPathContext context) Traverses the XPath and returns an Iterator of Pointers.voidremoveAll(JXPathContext context) Remove all graph elements described by this expression.voidremovePath(JXPathContext context) Remove the graph element described by this expression.voidsetValue(JXPathContext context, Object value) Modifies the value of the property described by the supplied xpath.toString()
-
Constructor Details
-
JXPathCompiledExpression
Constructs a new JXPathCompiledExpression.- Parameters:
xpath- sourceexpression- compiled
-
-
Method Details
-
createPath
Description copied from interface:CompiledExpressionCreates intermediate elements of the path by invoking anAbstractFactory, which should first be installed on the context by callingJXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory).- Specified by:
createPathin interfaceCompiledExpression- Parameters:
context- base- Returns:
- Pointer created
-
createPathAndSetValue
Description copied from interface:CompiledExpressionThe same as setValue, except it creates intermediate elements of the path by invoking anAbstractFactory, which should first be installed on the context by callingJXPathContext.setFactory(org.apache.commons.jxpath.AbstractFactory).Will throw an exception if one of the following conditions occurs:
- Elements of the XPath aleady exist, by the path does not in fact describe an existing property
- The AbstractFactory fails to create an instance for an intermediate element.
- The property is not writable (no public, non-static set method)
- Specified by:
createPathAndSetValuein interfaceCompiledExpression- Parameters:
context- basevalue- to set- Returns:
- Pointer created
-
getExpression
Gets the compiled expression.- Returns:
- Expression
-
getPointer
Description copied from interface:CompiledExpressionTraverses the XPath and returns a Pointer. A Pointer provides easy access to a property. If the XPath matches no properties in the graph, the pointer will be null.- Specified by:
getPointerin interfaceCompiledExpression- Parameters:
context- basexpath- string- Returns:
- Pointer found
-
getValue
Description copied from interface:CompiledExpressionEvaluates the XPath and returns the resulting object. Primitive types are wrapped into objects.- Specified by:
getValuein interfaceCompiledExpression- Parameters:
context- to evaluate- Returns:
- Object
-
getValue
Description copied from interface:CompiledExpressionEvaluates the xpath, converts the result to the specified class and returns the resulting object.- Specified by:
getValuein interfaceCompiledExpression- Parameters:
context- to evaluaterequiredType- return type- Returns:
- Object
-
getXPath
Gets the source expression.- Returns:
- String
-
iterate
Description copied from interface:CompiledExpressionTraverses the XPath and returns a Iterator of all results found for the path. If the XPath matches no properties in the graph, the Iterator will not be null.- Specified by:
iteratein interfaceCompiledExpression- Parameters:
context- base- Returns:
- Iterator
-
iteratePointers
Description copied from interface:CompiledExpressionTraverses the XPath and returns an Iterator of Pointers. A Pointer provides easy access to a property. If the XPath matches no properties in the graph, the Iterator be empty, but not null.- Specified by:
iteratePointersin interfaceCompiledExpression- Parameters:
context- to iterate- Returns:
- Iterator
-
removeAll
Description copied from interface:CompiledExpressionRemove all graph elements described by this expression.- Specified by:
removeAllin interfaceCompiledExpression- Parameters:
context- base
-
removePath
Description copied from interface:CompiledExpressionRemove the graph element described by this expression.- Specified by:
removePathin interfaceCompiledExpression- Parameters:
context- base
-
setValue
Description copied from interface:CompiledExpressionModifies the value of the property described by the supplied xpath. Will throw an exception if one of the following conditions occurs:- The XPath does not in fact describe an existing property
- The property is not writable (no public, non-static set method)
- Specified by:
setValuein interfaceCompiledExpression- Parameters:
context- basevalue- to set
-
toString
-