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 Expression
Gets 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 String
getXPath()
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.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.toString()
-
Constructor Details
-
JXPathCompiledExpression
Constructs a new JXPathCompiledExpression.- Parameters:
xpath
- sourceexpression
- compiled
-
-
Method Details
-
createPath
Description copied from interface:CompiledExpression
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)
.- Specified by:
createPath
in interfaceCompiledExpression
- Parameters:
context
- base- Returns:
- Pointer created
-
createPathAndSetValue
Description copied from interface:CompiledExpression
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)
.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:
createPathAndSetValue
in interfaceCompiledExpression
- Parameters:
context
- basevalue
- to set- Returns:
- Pointer created
-
getExpression
Gets the compiled expression.- Returns:
- Expression
-
getPointer
Description copied from interface:CompiledExpression
Traverses 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:
getPointer
in interfaceCompiledExpression
- Parameters:
context
- basexpath
- string- Returns:
- Pointer found
-
getValue
Description copied from interface:CompiledExpression
Evaluates the XPath and returns the resulting object. Primitive types are wrapped into objects.- Specified by:
getValue
in interfaceCompiledExpression
- Parameters:
context
- to evaluate- Returns:
- Object
-
getValue
Description copied from interface:CompiledExpression
Evaluates the xpath, converts the result to the specified class and returns the resulting object.- Specified by:
getValue
in interfaceCompiledExpression
- Parameters:
context
- to evaluaterequiredType
- return type- Returns:
- Object
-
getXPath
Gets the source expression.- Returns:
- String
-
iterate
Description copied from interface:CompiledExpression
Traverses 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:
iterate
in interfaceCompiledExpression
- Parameters:
context
- base- Returns:
- Iterator
-
iteratePointers
Description copied from interface:CompiledExpression
Traverses 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:
iteratePointers
in interfaceCompiledExpression
- Parameters:
context
- to iterate- Returns:
- Iterator
-
removeAll
Description copied from interface:CompiledExpression
Remove all graph elements described by this expression.- Specified by:
removeAll
in interfaceCompiledExpression
- Parameters:
context
- base
-
removePath
Description copied from interface:CompiledExpression
Remove the graph element described by this expression.- Specified by:
removePath
in interfaceCompiledExpression
- Parameters:
context
- base
-
setValue
Description copied from interface:CompiledExpression
Modifies 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:
setValue
in interfaceCompiledExpression
- Parameters:
context
- basevalue
- to set
-
toString
-