Interface FunctionDefinition
- All Known Implementing Classes:
AwsPartition.Definition,BooleanEquals.Definition,Coalesce.Definition,GetAttr.Definition,IsSet.Definition,IsValidHostLabel.Definition,IsVirtualHostableS3Bucket.Definition,Ite.Definition,Not.Definition,ParseArn.Definition,ParseUrl.Definition,Split.Definition,StringEquals.Definition,Substring.Definition,UriEncode.Definition
public interface FunctionDefinition
An abstract definition of a rule-engine function.
-
Method Summary
Modifier and TypeMethodDescriptioncreateFunction(FunctionNode functionNode) Creates aLibraryFunctionimplementation from the givenFunctionNode.Evaluate the arguments to a given function to compute a result.The arguments to this function.default intgetCost()Returns the relative cost of evaluating this function.getId()The ID of this function.The return type of this function definition.Gets the type of variadic arguments if this function accepts them.
-
Method Details
-
getId
String getId()The ID of this function.- Returns:
- The ID string
-
getArguments
The arguments to this function.- Returns:
- The function arguments
-
getVariadicArguments
Gets the type of variadic arguments if this function accepts them.When present, the function accepts any number of additional arguments of this type after the fixed arguments from getArguments().
- Returns:
- the variadic argument type, or empty if not variadic
-
getReturnType
Type getReturnType()The return type of this function definition.- Returns:
- The function return type
-
evaluate
Evaluate the arguments to a given function to compute a result.- Returns:
- The resulting value
-
createFunction
Creates aLibraryFunctionimplementation from the givenFunctionNode.- Parameters:
functionNode- the function node to deserialize.- Returns:
- the created LibraryFunction implementation.
-
getCost
default int getCost()Returns the relative cost of evaluating this function.Lower values indicate cheaper operations. This cost is used by BDD optimizations to prefer evaluating cheaper conditions earlier, enabling short-circuit evaluation to skip expensive operations when possible.
- Returns:
- the relative evaluation cost (default: 100)
-