Interface InternalFunction
- All Superinterfaces:
Expression
,Function
- All Known Implementing Classes:
InternalVolatileFunction
Special
Function
type indicating that that the function is to be executed exclusively at run-time, and does
not participate in the SPI (Service Provider Interface) lookup mechanism (i.e. cannot be created using a
FilterFactory
).
This is a (non OGC Filter compatible) extension point to the Filter API to allow for anonymous inner classes to be used in filters.
The additional duplicate(Expression...)
method allows for implementations to return a new instance of the
function for the given set of arguments.
Usage example:
InternalFunction function = new InternalFunction(){
public String getName(){ return "MyFunction";}
public FunctionName getFunctionName(){ return new FunctionNameImpl(getName(), 0);}
public List getParameters(){ return Collections.emptyList(); }
public Literal getFallbackValue() { return null; }
public Object evaluate(Object object){
return determineRuntimeFunctionValue(object);
}
public InternalFunction duplicate(Expression... parameters){
return this;
}
}
FilterFactory ff = ..
Filter filter = ff.equals(ff.literal(Boolean.TRUE), function);
- Since:
- 9.0
-
Field Summary
Fields inherited from interface Expression
NIL
-
Method Summary
Modifier and TypeMethodDescriptionduplicate
(Expression... parameters) Factory method to return a new instance of its own kind that works on the given parameters.Methods inherited from interface Expression
accept, evaluate, evaluate
Methods inherited from interface Function
getFallbackValue, getFunctionName, getName, getParameters
-
Method Details
-
duplicate
Factory method to return a new instance of its own kind that works on the given parameters.This is so because InternalFunctions do not participate on the standard SPI lookup mechanism and hence they can't be created by
FilterFactory
, yet on occasion a new copy might be needed, such as for duplicating filter visitors.Note however implementations are free to return
this
if the actual function instance does not work withExpression
as parameters.- Parameters:
parameters
- the parameters the returned InternalFunction works on- Returns:
- a new instance of the same kind of InternalFunction that works on the given parameters
-