org.geotools.filter
Class FilterAttributeExtractor

Object
  extended by DefaultFilterVisitor
      extended by FilterAttributeExtractor
All Implemented Interfaces:
ExpressionVisitor, FilterVisitor
Direct Known Subclasses:
MetaBufferEstimator, StyleAttributeExtractor

public class FilterAttributeExtractor
extends DefaultFilterVisitor

A simple visitor that extracts every attribute used by a filter or an expression

Access to this class is available via:

The class can also be used to determine if an expression is "static", that is, despite a complex structure does not use attribute or volatile functions, and can be thus replaced by a constant: for this use case refer to the isConstantExpression() method

Author:
Andrea Aime - GeoSolutions

Field Summary
protected  Set<String> attributeNames
          Last set visited
protected  SimpleFeatureType featureType
          feature type to evaluate against
protected  Set<PropertyName> propertyNames
           
protected  boolean usingDynamicProperties
           
protected  boolean usingVolatileFunctions
           
 
Constructor Summary
FilterAttributeExtractor()
          Just extract the property names; don't check against a feature type.
FilterAttributeExtractor(SimpleFeatureType featureType)
          Use the provided feature type as a sanity check when extracting property names.
 
Method Summary
 void clear()
          Resets the attributes found so that a new attribute search can be performed
 String[] getAttributeNames()
          Array of attribute names found (so far).
 Set<String> getAttributeNameSet()
          Attributes names found (so far).
 Set<PropertyName> getPropertyNameSet()
          Lists the PropertyNames found so far; useful when dealing with cpath expressions involving namespace informaiton.
 boolean isConstantExpression()
          Returns true if the last visited expression is a constant, that is, does not depend on any attribute and does not use any VolatileFunction
 boolean isUsingDynamincProperties()
          Returns true if the expression is using dynamic property names, so a static analysis of the expression won't be able to return all the properties in use
 Object visit(Function expression, Object data)
           
 Object visit(PropertyName expression, Object data)
           
 
Methods inherited from class DefaultFilterVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitNullFilter
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributeNames

protected Set<String> attributeNames
Last set visited


propertyNames

protected Set<PropertyName> propertyNames

usingVolatileFunctions

protected boolean usingVolatileFunctions

usingDynamicProperties

protected boolean usingDynamicProperties

featureType

protected SimpleFeatureType featureType
feature type to evaluate against

Constructor Detail

FilterAttributeExtractor

public FilterAttributeExtractor()
Just extract the property names; don't check against a feature type.


FilterAttributeExtractor

public FilterAttributeExtractor(SimpleFeatureType featureType)
Use the provided feature type as a sanity check when extracting property names.

Parameters:
featureType -
Method Detail

getAttributeNameSet

public Set<String> getAttributeNameSet()
Attributes names found (so far).

Returns:
an unmofiable set of the attribute names found so far during the visit

getPropertyNameSet

public Set<PropertyName> getPropertyNameSet()
Lists the PropertyNames found so far; useful when dealing with cpath expressions involving namespace informaiton.

Returns:

getAttributeNames

public String[] getAttributeNames()
Array of attribute names found (so far).

Returns:
an array of the attribute names found so far during the visit

clear

public void clear()
Resets the attributes found so that a new attribute search can be performed


visit

public Object visit(PropertyName expression,
                    Object data)
Specified by:
visit in interface ExpressionVisitor
Overrides:
visit in class DefaultFilterVisitor

visit

public Object visit(Function expression,
                    Object data)
Specified by:
visit in interface ExpressionVisitor
Overrides:
visit in class DefaultFilterVisitor

isConstantExpression

public boolean isConstantExpression()
Returns true if the last visited expression is a constant, that is, does not depend on any attribute and does not use any VolatileFunction

Returns:

isUsingDynamincProperties

public boolean isUsingDynamincProperties()
Returns true if the expression is using dynamic property names, so a static analysis of the expression won't be able to return all the properties in use

Returns:


Copyright © 1996-2014 Geotools. All Rights Reserved.