Class FilterAttributeExtractor

  • All Implemented Interfaces:
    ExpressionVisitor, FilterVisitor
    Direct Known Subclasses:
    MetaBufferEstimator, MultipleValueExtractor, 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:

    • DataUtilities.attributeNames( Filter )
    • DataUtilities.attributeNames( Filter, FeatureType )
    • DataUtilities.attributeNames( Expression )
    • DataUtilities.attributeNames( Expression, FeatureType )
    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
    Andrea Aime - GeoSolutions
    • Field Detail

      • attributeNames

        protected Set<String> attributeNames
        Last set visited
      • 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.
    • Method Detail

      • getAttributeNameSet

        public Set<String> getAttributeNameSet()
        Attributes names found (so far).
        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.
      • getAttributeNames

        public String[] getAttributeNames()
        Array of attribute names found (so far).
        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
      • 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
      • 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