org.geotools.filter.visitor
Class IsStaticExpressionVisitor

Object
  extended by IsStaticExpressionVisitor
All Implemented Interfaces:
ExpressionVisitor

public class IsStaticExpressionVisitor
extends Object
implements ExpressionVisitor

Check if an expression is static (ie does not contain a PropertyName expression).

This visitor will "short-circuit" the moment it finds a PropertyName expression and will not need to visit the entire data structure.

Example:


 if( filter.accepts( IsStaticExpressionVisitor.VISITOR, null ) ){
     Color color = expression.evaulate( null, Color.class );
     ...
 }
 

Author:
Jody
Module:
modules/library/main (gt-main.jar)

Field Summary
static IsStaticExpressionVisitor VISITOR
           
 
Constructor Summary
protected IsStaticExpressionVisitor()
          visit each expression and check that they are static
 
Method Summary
 Boolean visit(Add expression, Object data)
          visit each expression and check that they are static
 Boolean visit(Divide expression, Object data)
          visit each expression and check that they are static
 Boolean visit(Function expression, Object data)
          Visit each parameter and check if they are static
 Boolean visit(Literal expression, Object data)
          Literal expressions are always static.
 Boolean visit(Multiply expression, Object data)
          visit each expression and check that they are static.
 Boolean visit(NilExpression expression, Object data)
          visit each expression and check that they are static
 Boolean visit(PropertyName expression, Object data)
          If even a single PropertyName is found in the expression the expression is not static.
 Boolean visit(Subtract expression, Object data)
          visit each expression and check that they are static.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VISITOR

public static final IsStaticExpressionVisitor VISITOR
Constructor Detail

IsStaticExpressionVisitor

protected IsStaticExpressionVisitor()
visit each expression and check that they are static

Method Detail

visit

public Boolean visit(NilExpression expression,
                     Object data)
visit each expression and check that they are static

Specified by:
visit in interface ExpressionVisitor

visit

public Boolean visit(Add expression,
                     Object data)
visit each expression and check that they are static

Specified by:
visit in interface ExpressionVisitor

visit

public Boolean visit(Divide expression,
                     Object data)
visit each expression and check that they are static

Specified by:
visit in interface ExpressionVisitor

visit

public Boolean visit(Function expression,
                     Object data)
Visit each parameter and check if they are static

Specified by:
visit in interface ExpressionVisitor

visit

public Boolean visit(Literal expression,
                     Object data)
Literal expressions are always static.

Specified by:
visit in interface ExpressionVisitor
Returns:
true

visit

public Boolean visit(Multiply expression,
                     Object data)
visit each expression and check that they are static.

Specified by:
visit in interface ExpressionVisitor
Returns:
true if getExpression1 and getExpression2 are static

visit

public Boolean visit(PropertyName expression,
                     Object data)
If even a single PropertyName is found in the expression the expression is not static.

Specified by:
visit in interface ExpressionVisitor
Returns:
false

visit

public Boolean visit(Subtract expression,
                     Object data)
visit each expression and check that they are static.

Specified by:
visit in interface ExpressionVisitor
Returns:
true if getExpression1 and getExpression2 are static


Copyright © 1996-2009 Geotools. All Rights Reserved.