public abstract class FunctionExpressionImpl extends DefaultExpression implements FunctionExpression
By default this implementation returns the provided fallback
value. To implement a
function please override the evaluate(Object)
method.
Modifier and Type | Field and Description |
---|---|
protected Literal |
fallback |
protected FunctionName |
functionName
FunctionName provided by subclass; or lazely created
|
protected String |
name
function name *
|
protected List<Expression> |
params
function params *
|
NIL
Modifier | Constructor and Description |
---|---|
protected |
FunctionExpressionImpl(FunctionName functionName)
Preferred constructor to ensure name and functionName match.
|
protected |
FunctionExpressionImpl(Name name) |
protected |
FunctionExpressionImpl(Name name,
Literal fallback)
Creates a new instance of FunctionExpression
|
protected |
FunctionExpressionImpl(String name) |
protected |
FunctionExpressionImpl(String name,
Literal fallback)
Creates a new instance of FunctionExpression
|
Modifier and Type | Method and 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 index
|
Literal |
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.
|
isAttributeExpression, isExpression, isFunctionExpression, isGeometryExpression, isLiteralExpression, isMathExpression
evaluate
evaluate
protected String name
protected List<Expression> params
protected Literal fallback
protected FunctionName functionName
protected FunctionExpressionImpl(FunctionName functionName)
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); }
functionName
- FunctionName describing subclassprotected FunctionExpressionImpl(String name)
protected FunctionExpressionImpl(Name name)
protected FunctionExpressionImpl(String name, Literal fallback)
public String getName()
public FunctionName getFunctionName()
Function
getFunctionName
in interface Function
public Literal getFallbackValue()
Function
getFallbackValue
in interface Function
public void setFallbackValue(Literal fallback)
FunctionExpression
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.
setFallbackValue
in interface FunctionExpression
public List<Expression> getParameters()
getParameters
in interface Function
public void setParameters(List<Expression> params)
setParameters
in interface FunctionExpression
public Object accept(ExpressionVisitor visitor, Object extraData)
Expression
return visitor.visit(this, extraData);
accept
in interface Expression
Expression.accept(ExpressionVisitor, Object)
public Map<RenderingHints.Key,?> getImplementationHints()
getImplementationHints
in interface Factory
protected static FunctionName functionName(String name, String ret, String... args)
public String toString()
protected Expression getExpression(int index)
index
- public Object evaluate(Object object)
ExpressionAbstract
evaluate
in interface Expression
evaluate
in class ExpressionAbstract
Copyright © 1996–2019 Geotools. All rights reserved.