org.deegree.filter.expression
Class ValueReference

java.lang.Object
  extended by org.deegree.filter.expression.ValueReference
All Implemented Interfaces:
Expression

public class ValueReference
extends Object
implements Expression

Expression that contains an XPath 1.0 expression, a simple property name or an arbitrary identifier. Before Filter Encoding 2.0.0, this kind of expression was known as PropertyName.

Depending on the content, the targeted property can be accessed as follows:

Version:
$Revision:$, $Date:$
Author:
Markus Schneider , last edited by: $Author:$

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.deegree.filter.Expression
Expression.Type
 
Constructor Summary
ValueReference(QName name)
          Creates a new ValueReference instance that selects a property.
ValueReference(String text, org.jaxen.NamespaceContext nsContext)
          Creates a new ValueReference instance from an encoded XPath-expression and the namespace bindings.
 
Method Summary
 boolean equals(Object other)
           
<T> TypedObjectNode[]
evaluate(T obj, XPathEvaluator<T> xpathEvaluator)
          Determines the values of the expression for the given context object.
 QName getAsQName()
          If the property name is simple, the element name is returned.
 String getAsText()
          Returns the property name value (an XPath-expression).
 org.jaxen.expr.Expr getAsXPath()
          Returns the Jaxen representation of the XPath expression, which provides access to the syntax tree.
 NamespaceBindings getNsContext()
          Returns the bindings for the namespaces used in the XPath expression.
 Expression[] getParams()
          Returns the expression's paramters.
 Expression.Type getType()
          Returns the type of expression.
 int hashCode()
           
 void set(String text, org.jaxen.NamespaceContext nsContext)
           
 String toString()
           
 String toString(String indent)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueReference

public ValueReference(String text,
                      org.jaxen.NamespaceContext nsContext)
               throws IllegalArgumentException
Creates a new ValueReference instance from an encoded XPath-expression and the namespace bindings.

Parameters:
text - must be a valid XPath 1.0-expression, must not be null
nsContext - binding of the namespaces used in the XPath expression, may be null
Throws:
IllegalArgumentException

ValueReference

public ValueReference(QName name)
Creates a new ValueReference instance that selects a property.

Parameters:
name - qualified name of the property, never null
Method Detail

set

public void set(String text,
                org.jaxen.NamespaceContext nsContext)

getAsXPath

public org.jaxen.expr.Expr getAsXPath()
Returns the Jaxen representation of the XPath expression, which provides access to the syntax tree.

Returns:
the compiled expression, or null if the property name is not an XPath expression

getAsText

public String getAsText()
Returns the property name value (an XPath-expression).

Returns:
the XPath property name, this may be an empty string, but never null

getAsQName

public QName getAsQName()
If the property name is simple, the element name is returned.

Returns:
the qualified name value, or null if the property name is not simple

getNsContext

public NamespaceBindings getNsContext()
Returns the bindings for the namespaces used in the XPath expression.

Returns:
the namespace bindings, never null

getType

public Expression.Type getType()
Description copied from interface: Expression
Returns the type of expression. Use this to safely determine the subtype of Expression.

Specified by:
getType in interface Expression
Returns:
type of expression

evaluate

public <T> TypedObjectNode[] evaluate(T obj,
                                      XPathEvaluator<T> xpathEvaluator)
                           throws FilterEvaluationException
Description copied from interface: Expression
Determines the values of the expression for the given context object.

Note that this returns an TypedObjectNode[], as an expression may evaluate to multiple values, e.g. a ValueReference that targets a multi property of a feature.

Specified by:
evaluate in interface Expression
Type Parameters:
T - type of the context object
Parameters:
obj - object that the expression is evaluated upon, must not be null
xpathEvaluator - used for evaluation of XPath expressions, must not be null
Returns:
the values of the expression, may be empty (and even contain null values), but never null
Throws:
FilterEvaluationException

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(String indent)
Specified by:
toString in interface Expression

getParams

public Expression[] getParams()
Description copied from interface: Expression
Returns the expression's paramters.

Specified by:
getParams in interface Expression
Returns:
the parameters of the expression

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2011. All Rights Reserved.