org.apache.commons.jxpath.ri
Class JXPathCompiledExpression

java.lang.Object
  extended byorg.apache.commons.jxpath.ri.JXPathCompiledExpression
All Implemented Interfaces:
CompiledExpression

public class JXPathCompiledExpression
extends java.lang.Object
implements CompiledExpression

Version:
$Revision: 1.9 $ $Date: 2004/02/29 14:17:45 $
Author:
Dmitri Plotnikov

Field Summary
private  Expression expression
           
private  java.lang.String xpath
           
 
Constructor Summary
JXPathCompiledExpression(java.lang.String xpath, Expression expression)
           
 
Method Summary
 Pointer createPath(JXPathContext context)
          Creates intermediate elements of the path by invoking an AbstractFactory, which should first be installed on the context by calling "setFactory".
 Pointer createPathAndSetValue(JXPathContext context, 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 "setFactory".
protected  Expression getExpression()
           
 Pointer getPointer(JXPathContext context, java.lang.String xpath)
          Traverses the xpath and returns a Pointer.
 java.lang.Object getValue(JXPathContext context)
          Evaluates the xpath and returns the resulting object.
 java.lang.Object getValue(JXPathContext context, java.lang.Class requiredType)
          Evaluates the xpath, converts the result to the specified class and returns the resulting object.
protected  java.lang.String getXPath()
           
 java.util.Iterator iterate(JXPathContext context)
          Traverses the xpath and returns a Iterator of all results found for the path.
 java.util.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, java.lang.Object value)
          Modifies the value of the property described by the supplied xpath.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xpath

private java.lang.String xpath

expression

private Expression expression
Constructor Detail

JXPathCompiledExpression

public JXPathCompiledExpression(java.lang.String xpath,
                                Expression expression)
Method Detail

getXPath

protected java.lang.String getXPath()

getExpression

protected Expression getExpression()

toString

public java.lang.String toString()

getValue

public java.lang.Object getValue(JXPathContext context)
Description copied from interface: CompiledExpression
Evaluates the xpath and returns the resulting object. Primitive types are wrapped into objects.

Specified by:
getValue in interface CompiledExpression
See Also:
CompiledExpression.getValue(JXPathContext)

getValue

public java.lang.Object getValue(JXPathContext context,
                                 java.lang.Class requiredType)
Description copied from interface: CompiledExpression
Evaluates the xpath, converts the result to the specified class and returns the resulting object.

Specified by:
getValue in interface CompiledExpression
See Also:
CompiledExpression.getValue(JXPathContext, Class)

setValue

public void setValue(JXPathContext context,
                     java.lang.Object value)
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:

Specified by:
setValue in interface CompiledExpression
See Also:
CompiledExpression.setValue(JXPathContext, Object)

createPath

public Pointer createPath(JXPathContext context)
Description copied from interface: CompiledExpression
Creates intermediate elements of the path by invoking an AbstractFactory, which should first be installed on the context by calling "setFactory".

Specified by:
createPath in interface CompiledExpression
See Also:
CompiledExpression.createPath(JXPathContext)

createPathAndSetValue

public Pointer createPathAndSetValue(JXPathContext context,
                                     java.lang.Object value)
Description copied from interface: CompiledExpression
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 "setFactory".

Will throw an exception if one of the following conditions occurs:

Specified by:
createPathAndSetValue in interface CompiledExpression
See Also:
CompiledExpression.createPathAndSetValue(JXPathContext, Object)

iterate

public java.util.Iterator iterate(JXPathContext context)
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 interface CompiledExpression
See Also:
CompiledExpression.iterate(JXPathContext)

getPointer

public Pointer getPointer(JXPathContext context,
                          java.lang.String xpath)
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 interface CompiledExpression
See Also:
CompiledExpression.getPointer(JXPathContext, String)

iteratePointers

public java.util.Iterator iteratePointers(JXPathContext context)
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 interface CompiledExpression
See Also:
CompiledExpression.iteratePointers(JXPathContext)

removePath

public void removePath(JXPathContext context)
Description copied from interface: CompiledExpression
Remove the graph element described by this expression

Specified by:
removePath in interface CompiledExpression
See Also:
CompiledExpression.removePath(JXPathContext)

removeAll

public void removeAll(JXPathContext context)
Description copied from interface: CompiledExpression
Remove all graph elements described by this expression

Specified by:
removeAll in interface CompiledExpression
See Also:
CompiledExpression.removeAll(JXPathContext)