Package org.geotools.filter
Class FunctionExpressionImpl
- Object
-
- ExpressionAbstract
-
- DefaultExpression
-
- FunctionExpressionImpl
-
- All Implemented Interfaces:
Expression
,Function
,FunctionExpression
,Factory
- Direct Known Subclasses:
AndFunction
,AreaFunction
,ArrayFunction
,AsMultiGeometryFunctionExpression
,AtFunction
,AttributeCountFunction
,BandsFunction
,ClassifyFunction
,Collection_AverageFunction
,Collection_BoundsFunction
,Collection_CountFunction
,Collection_MaxFunction
,Collection_MedianFunction
,Collection_MinFunction
,Collection_SumFunction
,Collection_UniqueFunction
,CollectionIdFunction
,CollectionLinkFunction
,DateDifferenceFunction
,EnvFunction
,FallbackFunction
,FilterFunction_abs
,FilterFunction_abs_2
,FilterFunction_abs_3
,FilterFunction_abs_4
,FilterFunction_acos
,FilterFunction_area
,FilterFunction_asin
,FilterFunction_atan
,FilterFunction_atan2
,FilterFunction_between
,FilterFunction_boundary
,FilterFunction_boundaryDimension
,FilterFunction_buffer
,FilterFunction_bufferWithSegments
,FilterFunction_ceil
,FilterFunction_centroid
,FilterFunction_contains
,FilterFunction_Convert
,FilterFunction_convexHull
,FilterFunction_cos
,FilterFunction_crosses
,FilterFunction_dateFormat
,FilterFunction_dateParse
,FilterFunction_difference
,FilterFunction_dimension
,FilterFunction_disjoint
,FilterFunction_disjoint3D
,FilterFunction_distance
,FilterFunction_distance3D
,FilterFunction_double2bool
,FilterFunction_endAngle
,FilterFunction_endPoint
,FilterFunction_envelope
,FilterFunction_equalsExact
,FilterFunction_equalsExactTolerance
,FilterFunction_equalTo
,FilterFunction_exp
,FilterFunction_exteriorRing
,FilterFunction_floor
,FilterFunction_geometryType
,FilterFunction_geomFromWKT
,FilterFunction_geomLength
,FilterFunction_getGeometryN
,FilterFunction_getX
,FilterFunction_getY
,FilterFunction_getZ
,FilterFunction_greaterEqualThan
,FilterFunction_greaterThan
,FilterFunction_IEEEremainder
,FilterFunction_if_then_else
,FilterFunction_in10
,FilterFunction_in2
,FilterFunction_in3
,FilterFunction_in4
,FilterFunction_in5
,FilterFunction_in6
,FilterFunction_in7
,FilterFunction_in8
,FilterFunction_in9
,FilterFunction_int2bbool
,FilterFunction_int2ddouble
,FilterFunction_interiorPoint
,FilterFunction_interiorRingN
,FilterFunction_intersection
,FilterFunction_intersects
,FilterFunction_intersects3D
,FilterFunction_isClosed
,FilterFunction_isCoverage
,FilterFunction_isEmpty
,FilterFunction_isLike
,FilterFunction_isNull
,FilterFunction_isometric
,FilterFunction_isRing
,FilterFunction_isSimple
,FilterFunction_isValid
,FilterFunction_isWithinDistance
,FilterFunction_isWithinDistance3D
,FilterFunction_lessEqualThan
,FilterFunction_lessThan
,FilterFunction_list
,FilterFunction_listMultiply
,FilterFunction_log
,FilterFunction_max
,FilterFunction_max_2
,FilterFunction_max_3
,FilterFunction_max_4
,FilterFunction_min
,FilterFunction_min_2
,FilterFunction_min_3
,FilterFunction_min_4
,FilterFunction_minimumCircle
,FilterFunction_minimumDiameter
,FilterFunction_minimumRectangle
,FilterFunction_not
,FilterFunction_notEqualTo
,FilterFunction_numberFormat
,FilterFunction_numberFormat2
,FilterFunction_numGeometries
,FilterFunction_numInteriorRing
,FilterFunction_numPoints
,FilterFunction_octagonalEnvelope
,FilterFunction_offset
,FilterFunction_overlaps
,FilterFunction_parseBoolean
,FilterFunction_parseDouble
,FilterFunction_parseInt
,FilterFunction_parseLong
,FilterFunction_pgNearest
,FilterFunction_pointN
,FilterFunction_pow
,FilterFunction_property
,FilterFunction_random
,FilterFunction_relate
,FilterFunction_relatePattern
,FilterFunction_rint
,FilterFunction_round
,FilterFunction_round_2
,FilterFunction_roundDouble
,FilterFunction_sdonn
,FilterFunction_setCRS
,FilterFunction_sin
,FilterFunction_sqrt
,FilterFunction_startAngle
,FilterFunction_startPoint
,FilterFunction_strAbbreviate
,FilterFunction_strCapitalize
,FilterFunction_strConcat
,FilterFunction_strDefaultIfBlank
,FilterFunction_strEndsWith
,FilterFunction_strEqualsIgnoreCase
,FilterFunction_strIndexOf
,FilterFunction_strLastIndexOf
,FilterFunction_strLength
,FilterFunction_strMatches
,FilterFunction_strPosition
,FilterFunction_strReplace
,FilterFunction_strStartsWith
,FilterFunction_strStripAccents
,FilterFunction_strSubstring
,FilterFunction_strSubstringStart
,FilterFunction_strToLowerCase
,FilterFunction_strToUpperCase
,FilterFunction_strTrim
,FilterFunction_strTrim2
,FilterFunction_symDifference
,FilterFunction_tan
,FilterFunction_toDegrees
,FilterFunction_toRadians
,FilterFunction_touches
,FilterFunction_toWKT
,FilterFunction_union
,FilterFunction_vertices
,FilterFunction_within
,GeometryFunction
,GetFunction
,HasFunction
,IDFunction
,IDFunctionExpression
,InArrayFunction
,InFunction
,IntegerDivisionFunction
,JsonArrayContainsFunction
,JsonPointerFunction
,JsonSelectAllFunction
,JsonSelectFunction
,LapplyFunction
,LengthFunction
,LinFunction
,ListSizeFunction
,LitemFunction
,LiterateFunction
,MapBoxAnchorFunction
,MapBoxLengthFunction
,MapGetFunction
,NestedCollectionLinkFunction
,NorthFix
,NowFunction
,OrFunction
,PaletteFunction
,PiFunction
,PointOnLineFunction
,PropertyExistsFunction
,RescaleToPixelsFunction
,SizeFunction
,ToRgb
,URLEncodeFunction
,ZoomLevelFunction
public abstract class FunctionExpressionImpl extends DefaultExpression implements FunctionExpression
Abstract class for a function expression implementationBy default this implementation returns the provided
fallback
value. To implement a function please override theevaluate(Object)
method.- Author:
- James Macgill, PSU
-
-
Field Summary
Fields Modifier and Type Field Description protected Literal
fallback
protected FunctionName
functionName
FunctionName provided by subclass; or lazely createdprotected String
name
function name *protected List<Expression>
params
function params *-
Fields inherited from interface Expression
NIL
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FunctionExpressionImpl(String name)
protected
FunctionExpressionImpl(String name, Literal fallback)
Creates a new instance of FunctionExpressionprotected
FunctionExpressionImpl(Name name)
protected
FunctionExpressionImpl(Name name, Literal fallback)
Creates a new instance of FunctionExpressionprotected
FunctionExpressionImpl(FunctionName functionName)
Preferred constructor to ensure name and functionName match.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
accept(ExpressionVisitor visitor, Object extraData)
Accepts a visitor.boolean
equals(Object obj)
Object
evaluate(Object object)
Subclass should override, default implementation returns null.protected static FunctionName
functionName(String name, String ret, String... args)
Convenience method for creating a function name.protected Expression
getExpression(int index)
Utility method for subclasses to ask for an argument at a given indexLiteral
getFallbackValue()
The value of the fallbackValue attribute is used as a default value, if the SE implementation does not support the function.FunctionName
getFunctionName()
Access to the FunctionName description as used in a FilterCapabilities document.Map<RenderingHints.Key,?>
getImplementationHints()
Returns the implementation hints.String
getName()
Gets the name of this function.List<Expression>
getParameters()
Returns the function parameters.int
hashCode()
void
setFallbackValue(Literal fallback)
Fallback value to use in the event the function is unavailable in the requested environment.void
setParameters(List<Expression> params)
Sets the function parameters.String
toString()
Creates a String representation of this Function with the function name and the arguments.-
Methods inherited from class DefaultExpression
isAttributeExpression, isExpression, isFunctionExpression, isGeometryExpression, isLiteralExpression, isMathExpression
-
Methods inherited from class ExpressionAbstract
evaluate
-
Methods inherited from interface Expression
evaluate
-
-
-
-
Field Detail
-
name
protected String name
function name *
-
params
protected List<Expression> params
function params *
-
fallback
protected Literal fallback
-
functionName
protected FunctionName functionName
FunctionName provided by subclass; or lazely created
-
-
Constructor Detail
-
FunctionExpressionImpl
protected FunctionExpressionImpl(FunctionName functionName)
Preferred constructor to ensure name and functionName match.Recommended use:
import static org.geotools.filter.capability.FunctionNameImpl.*; public class AreaFunction extends FunctionExpressionImpl { public static FunctionName NAME = new FunctionNameImpl("Area", parameter("area",Double.class), parameter("geometry",Geometry.class)); public AreaFunction() { super(NAME); }
- Parameters:
functionName
- FunctionName describing subclass
-
FunctionExpressionImpl
protected FunctionExpressionImpl(String name)
-
FunctionExpressionImpl
protected FunctionExpressionImpl(Name name)
-
FunctionExpressionImpl
protected FunctionExpressionImpl(String name, Literal fallback)
Creates a new instance of FunctionExpression
-
-
Method Detail
-
getName
public String getName()
Gets the name of this function.
-
getFunctionName
public FunctionName getFunctionName()
Description copied from interface:Function
Access to the FunctionName description as used in a FilterCapabilities document.- Specified by:
getFunctionName
in interfaceFunction
- Returns:
- FunctionName description, if available.
-
getFallbackValue
public Literal getFallbackValue()
Description copied from interface:Function
The value of the fallbackValue attribute is used as a default value, if the SE implementation does not support the function. If the implementation supports the function, then the result value is determined by executing the function.- Specified by:
getFallbackValue
in interfaceFunction
- Returns:
- Optional literal to use if an implementation for this function is not available.
-
setFallbackValue
public void setFallbackValue(Literal fallback)
Description copied from interface:FunctionExpression
Fallback value to use in the event the function is unavailable in the requested environment.The fallback value is not provided as one of the arguments, as it is an advanced option used in style layer descriptor documents to facilitate interoperability. It allows a user to specify an SQL function, and provide a value to use when the documented is used with a WFS that does not support the provided function.
- Specified by:
setFallbackValue
in interfaceFunctionExpression
-
getParameters
public List<Expression> getParameters()
Returns the function parameters.- Specified by:
getParameters
in interfaceFunction
-
setParameters
public void setParameters(List<Expression> params)
Sets the function parameters.- Specified by:
setParameters
in interfaceFunctionExpression
-
accept
public Object accept(ExpressionVisitor visitor, Object extraData)
Description copied from interface:Expression
Accepts a visitor. Subclasses must implement with a method whose content is the following:return visitor.visit(this, extraData);
- Specified by:
accept
in interfaceExpression
- See Also:
Expression.accept(ExpressionVisitor, Object)
-
getImplementationHints
public Map<RenderingHints.Key,?> getImplementationHints()
Returns the implementation hints. The default implementation returns an empty map.- Specified by:
getImplementationHints
in interfaceFactory
- Returns:
- The map of hints, or an {@linkplain java.util.Collections.emptyMap() empty map} if none.
-
functionName
protected static FunctionName functionName(String name, String ret, String... args)
Convenience method for creating a function name.
-
toString
public String toString()
Creates a String representation of this Function with the function name and the arguments. The String created should be good for most subclasses
-
getExpression
protected Expression getExpression(int index)
Utility method for subclasses to ask for an argument at a given index
-
evaluate
public Object evaluate(Object object)
Description copied from class:ExpressionAbstract
Subclass should override, default implementation returns null.- Specified by:
evaluate
in interfaceExpression
- Overrides:
evaluate
in classExpressionAbstract
- Returns:
- default implementation returns null
-
-