public interface InternalFunction extends Function
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);
NIL
Modifier and Type | Method and Description |
---|---|
InternalFunction |
duplicate(Expression... parameters)
Factory method to return a new instance of its own kind that works on the given parameters.
|
getFallbackValue, getFunctionName, getName, getParameters
accept, evaluate, evaluate
InternalFunction duplicate(Expression... 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 with Expression
as parameters.
parameters
- the parameters the returned InternalFunction works onCopyright © 1996–2023 Geotools. All rights reserved.