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, isMathExpressionevaluateevaluateprotected 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()
FunctiongetFunctionName in interface Functionpublic Literal getFallbackValue()
FunctiongetFallbackValue in interface Functionpublic void setFallbackValue(Literal fallback)
FunctionExpressionThe 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 FunctionExpressionpublic List<Expression> getParameters()
getParameters in interface Functionpublic void setParameters(List<Expression> params)
setParameters in interface FunctionExpressionpublic Object accept(ExpressionVisitor visitor, Object extraData)
Expressionreturn visitor.visit(this, extraData);
accept in interface ExpressionExpression.accept(ExpressionVisitor, Object)public Map<RenderingHints.Key,?> getImplementationHints()
getImplementationHints in interface Factoryprotected static FunctionName functionName(String name, String ret, String... args)
public String toString()
protected Expression getExpression(int index)
public Object evaluate(Object object)
ExpressionAbstractevaluate in interface Expressionevaluate in class ExpressionAbstractCopyright © 1996–2021 Geotools. All rights reserved.