Interface UntypedFunction
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
IdentifiedFunction
,RiskscapeFunction
- All Known Implementing Classes:
AddAggregationFunction
,AggregationFunctionAdapter
,BinaryFunction
,BinaryOperatorFunction
,BinaryPredicateFunction
,ConstantFunction
,IdentifiedFunction.Wrapping
,JavaFunction
,MetadataBasedFunction
,NullSafeFunction
,RealizableFunction.MetadataIdentifiedRealizableFunction
,UnaryFunction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A minimal RiskscapeFunction
interface, which exists for two reasons: 1) store a reference
to a first-class function in a tuple 2) a minimal functional interface for use with creating minimal riskscape
functions without having to implement RiskscapeFunction
.
When an UntypedFunction
is using for storing a reference to a higher order/first class function as part of a
RiskScape pipeline or expression, we don't want to carry around all the extra type metadata with each instance of the
function, as this is going to be static, and just means needlessly holding on to more bytes. Hence this interface
exists, allowing implementations to be as light-touch on memory as possible.
When stored in a tuple, an UntypedFunction
is represented with a FunctionType
type, which stores
the signature for all instances of the function that can be in a tuple of that type.
-
Method Summary
-
Method Details
-
call
Execute the function with the given arguments.
- Parameters:
args
- list of arguments to the function that should conform to the types inArgumentList.getArgumentTypes()
-
close
default void close()Clean up any resources that were allocated with this function. This can include large objects, so that any memory used can be reclaimed.
See
Realized
for more information on the life-cycle of executable pipeline objects.Note that there is no standard mechanism for cleaning up resources allocated to functions that realize lambda expressions - the closing of any
RealizedExpression
s or related objects must be done by the function when it's closed. This is probably something that should be addressed once some standard patterns have been established for the implementation of lambda-accepting functions.- Specified by:
close
in interfaceAutoCloseable
-