Package org.geotools.filter.visitor
Class NullFilterVisitor
- Object
-
- NullFilterVisitor
-
- All Implemented Interfaces:
ExpressionVisitor
,FilterVisitor
- Direct Known Subclasses:
ExtractBoundsFilterVisitor
,TimeRangeVisitor
public abstract class NullFilterVisitor extends Object implements FilterVisitor, ExpressionVisitor
Abstract implementation of FilterVisitor simple returns the provided data.This class can be used as is as a placeholder that does nothing:
The class can also be used as an alternative to DefaultFilterVisitor if you want to only walk part of the data structure:Integer one = (Integer) filter.accepts( NullFilterVisitor.NULL_VISITOR, 1 );
The base class provides implementations for:FilterVisitor allFids = new NullFilterVisitor(){ public Object visit( Id filter, Object data ) { if( data == null) return null; Set set = (Set) data; set.addAll(filter.getIDs()); return set; } }; Set set = (Set) myFilter.accept(allFids, new HashSet()); Set set2 = (Set) myFilter.accept(allFids, null ); // set2 will be null
- walking And, Or, and Not data structures, returning null at any point will exit early
- a default implementation for every other construct that will return the provided data
- Author:
- Jody Garnett (Refractions Research)
-
-
Field Summary
Fields Modifier and Type Field Description static NullFilterVisitor
NULL_VISITOR
-
Constructor Summary
Constructors Constructor Description NullFilterVisitor()
-
Method Summary
-
-
-
Field Detail
-
NULL_VISITOR
public static NullFilterVisitor NULL_VISITOR
-
-
Method Detail
-
visit
public Object visit(ExcludeFilter filter, Object data)
Description copied from interface:FilterVisitor
VisitFilter.EXCLUDE
(often used during data structure transformations).- Specified by:
visit
in interfaceFilterVisitor
- Parameters:
filter
-Filter.EXCLUDE
.data
- Value object provided to visitor- Returns:
- subclass supplied
-
visit
public Object visit(IncludeFilter filter, Object data)
Description copied from interface:FilterVisitor
VisitFilter.INCLUDE
(often used during data structure transformations).- Specified by:
visit
in interfaceFilterVisitor
- Parameters:
filter
-Filter.INCLUDE
.data
- Value object provided to visitor- Returns:
- subclass supplied
-
visit
public Object visit(And filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Id filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Not filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Or filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsBetween filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsEqualTo filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsNotEqualTo filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsGreaterThan filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsGreaterThanOrEqualTo filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsLessThan filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsLessThanOrEqualTo filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsLike filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsNull filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(PropertyIsNil filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(BBOX filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Beyond filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Contains filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Crosses filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Disjoint filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(DWithin filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Equals filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Intersects filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Overlaps filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Touches filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Within filter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visitNullFilter
public Object visitNullFilter(Object data)
Description copied from interface:FilterVisitor
Used to account for anull
filter value.This is particularly used during data structure transofrmations, however the use of
null
is not recommended. Please make use of Filter.NONE and Filter.ALL as placeholder objects that communicate intent.- Specified by:
visitNullFilter
in interfaceFilterVisitor
- Parameters:
data
- Value object provided to visitor- Returns:
- subclass defined
-
visit
public Object visit(NilExpression expression, Object data)
Description copied from interface:ExpressionVisitor
Used to visit a Expression.NIL, also called fornull
where an expression is expected.This is particularly useful when doing data transformations, as an example when using a StyleSymbolizer Expression.NIL can be used to represent the default stroke color.
- Specified by:
visit
in interfaceExpressionVisitor
- Returns:
- implementation specific
-
visit
public Object visit(Add expression, Object data)
- Specified by:
visit
in interfaceExpressionVisitor
-
visit
public Object visit(Divide expression, Object data)
- Specified by:
visit
in interfaceExpressionVisitor
-
visit
public Object visit(Function expression, Object data)
- Specified by:
visit
in interfaceExpressionVisitor
-
visit
public Object visit(Literal expression, Object data)
- Specified by:
visit
in interfaceExpressionVisitor
-
visit
public Object visit(Multiply expression, Object data)
- Specified by:
visit
in interfaceExpressionVisitor
-
visit
public Object visit(PropertyName expression, Object data)
- Specified by:
visit
in interfaceExpressionVisitor
-
visit
public Object visit(Subtract expression, Object data)
- Specified by:
visit
in interfaceExpressionVisitor
-
visit
public Object visit(After after, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(AnyInteracts anyInteracts, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Before before, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Begins begins, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(BegunBy begunBy, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(During during, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(EndedBy endedBy, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Ends ends, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(Meets meets, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(MetBy metBy, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(OverlappedBy overlappedBy, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(TContains contains, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(TEquals equals, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(TOverlaps contains, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
visit
public Object visit(NativeFilter nativeFilter, Object data)
- Specified by:
visit
in interfaceFilterVisitor
-
-