org.geotools.filter.expression
Class ExpressionAbstract

Object
  extended by ExpressionAbstract
All Implemented Interfaces:
Expression
Direct Known Subclasses:
DefaultExpression, FunctionImpl

public abstract class ExpressionAbstract
extends Object
implements Expression

Abstract superclass of these Expression implementations.

Contains additional support for "Expression chaining". This allows Expressions to be constructed as a chain of Java commands similar to the use of the java collections api.

Note: Expression chaining is a simple developer convience, it has no effect on the data model exposed by the GeoAPI interfaces.

Idea: We may also be able to teach this implementation to make use of JXPath to extract "attribute values" from Java Beans, DOM, JDOM in addition to the geotools & geoapi FeatureType models. It is a cunning plan - any implementation will make use of this abstract base class.

Author:
Jody Garnett

Field Summary
 
Fields inherited from interface Expression
NIL
 
Constructor Summary
ExpressionAbstract()
           
 
Method Summary
protected  Object eval(Expression expression, SimpleFeature feature)
          Helper method for subclasses to reduce null checks
protected  Object eval(Expression expression, SimpleFeature feature)
          Helper method for subclasses to reduce null checks
 Object evaluate(Object object)
          Subclass should overide, default implementation returns null
 Object evaluate(Object object, Class context)
          Default implementation delegates handling of context conversion to Value utility class.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Expression
accept
 

Constructor Detail

ExpressionAbstract

public ExpressionAbstract()
Method Detail

evaluate

public Object evaluate(Object object)
Subclass should overide, default implementation returns null

Specified by:
evaluate in interface Expression

evaluate

public Object evaluate(Object object,
                       Class context)
Default implementation delegates handling of context conversion to Value utility class.

Subclasses are expected to make use of the Value utility class (as the easiest way to provide value morphing in confirmance with the Filter specification).

Specified by:
evaluate in interface Expression
Parameters:
object - The object to evaluate the expression against.
context - The type of the resulting value of the expression.
Returns:
Evaluates the given expression based on the content of the given object an an instance of context.

eval

protected Object eval(Expression expression,
                      SimpleFeature feature)
Helper method for subclasses to reduce null checks

Parameters:
expression -
feature -
Returns:
value or null

eval

protected Object eval(Expression expression,
                      SimpleFeature feature)
Helper method for subclasses to reduce null checks

Parameters:
expression -
feature -
Returns:
value or null


Copyright © 1996-2014 Geotools. All Rights Reserved.