deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.filter.expression
Class PropertyName

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

public class PropertyName
extends Object
implements Expression

Expression that usually just encodes the name of a property of an object, but may also contains an XPath 1.0 expression.

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
PropertyName(QName name)
          Creates a new PropertyName instance that select a property of a MatchableObject.
PropertyName(String text, org.jaxen.NamespaceContext nsContext)
          Creates a new PropertyName instance from an encoded XPath-expression and the namespace bindings.
 
Method Summary
 Object[] evaluate(MatchableObject obj)
          Determines the values of the expression for the given MatchableObject.
 QName getAsQName()
          If the property name is simple, the element name is returned.
 org.jaxen.expr.Expr getAsXPath()
          Returns the Jaxen representation of the XPath expression, which provides access to the syntax tree.
 org.jaxen.NamespaceContext getNsContext()
          Returns the bindings for the namespaces used in the XPath expression.
 Expression[] getParams()
          Returns the expression's paramters.
 String getPropertyName()
          Returns the property name value (an XPath-expression).
 Expression.Type getType()
          Returns the type of expression.
 boolean isSimple()
          Returns whether the property name is simple, i.e. if it only contains of a single element step.
 void set(String text, org.jaxen.NamespaceContext nsContext)
           
 String toString()
           
 String toString(String indent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyName

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

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

PropertyName

public PropertyName(QName name)
Creates a new PropertyName instance that select a property of a MatchableObject.

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()
                               throws FilterEvaluationException
Returns the Jaxen representation of the XPath expression, which provides access to the syntax tree.

Returns:
the compiled expression, or null if this PropertyName represents the empty string
Throws:
FilterEvaluationException - if this PropertyName does not denote a valid XPath 1.0 expression

getPropertyName

public String getPropertyName()
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
See Also:
isSimple()

getNsContext

public org.jaxen.NamespaceContext getNsContext()
Returns the bindings for the namespaces used in the XPath expression.

Returns:
the namespace bindings, never null

isSimple

public boolean isSimple()
Returns whether the property name is simple, i.e. if it only contains of a single element step.

Returns:
true, if the property is simple, false otherwise

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 Object[] evaluate(MatchableObject obj)
                  throws FilterEvaluationException
Description copied from interface: Expression
Determines the values of the expression for the given MatchableObject.

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

Specified by:
evaluate in interface Expression
Parameters:
obj - object that the expression is evaluated upon
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

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>