Package dev.cel.runtime
Class DefaultDispatcher
- java.lang.Object
-
- dev.cel.runtime.DefaultDispatcher
-
- All Implemented Interfaces:
Dispatcher
,Registrar
@ThreadSafe @Internal public final class DefaultDispatcher extends java.lang.Object implements Dispatcher, Registrar
Default implementation ofDispatcher
.Should be final, do not mock; mocking
Dispatcher
instead.CEL Library Internals. Do Not Use.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dev.cel.runtime.Registrar
Registrar.BinaryFunction<T1,T2>, Registrar.Function, Registrar.UnaryFunction<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> void
add(java.lang.String overloadId, java.lang.Class<T> argType, Registrar.UnaryFunction<T> function)
Adds a unary function to the dispatcher.<T1,T2>
voidadd(java.lang.String overloadId, java.lang.Class<T1> argType1, java.lang.Class<T2> argType2, Registrar.BinaryFunction<T1,T2> function)
Adds a binary function to the dispatcher.void
add(java.lang.String overloadId, java.util.List<java.lang.Class<?>> argTypes, Registrar.Function function)
Adds a general function to the dispatcher.static DefaultDispatcher
create()
Deprecated.Migrate to fluent APIs.static DefaultDispatcher
create(com.google.common.collect.ImmutableSet<ExprFeatures> features)
Deprecated.Migrate to fluent APIs.static DefaultDispatcher
create(CelOptions celOptions)
Deprecated.Migrate to fluent APIs.static DefaultDispatcher
create(CelOptions celOptions, DynamicProto dynamicProto, boolean enableStandardEnvironment)
java.lang.Object
dispatch(Metadata metadata, long exprId, java.lang.String functionName, java.util.List<java.lang.String> overloadIds, java.lang.Object[] args)
Invokes a function based on given parameters.Dispatcher.ImmutableCopy
immutableCopy()
Returns anDispatcher.ImmutableCopy
from current instance.
-
-
-
Method Detail
-
create
@Deprecated public static DefaultDispatcher create()
Deprecated.Migrate to fluent APIs. SeeCelRuntimeFactory
.Creates a new dispatcher with all standard functions.
-
create
@Deprecated public static DefaultDispatcher create(com.google.common.collect.ImmutableSet<ExprFeatures> features)
Deprecated.Migrate to fluent APIs. SeeCelRuntimeFactory
.Creates a new dispatcher with all standard functions.
-
create
@Deprecated public static DefaultDispatcher create(CelOptions celOptions)
Deprecated.Migrate to fluent APIs. SeeCelRuntimeFactory
.Creates a new dispatcher with all standard functions.
-
create
public static DefaultDispatcher create(CelOptions celOptions, DynamicProto dynamicProto, boolean enableStandardEnvironment)
-
add
public <T> void add(java.lang.String overloadId, java.lang.Class<T> argType, Registrar.UnaryFunction<T> function)
Description copied from interface:Registrar
Adds a unary function to the dispatcher.
-
add
public <T1,T2> void add(java.lang.String overloadId, java.lang.Class<T1> argType1, java.lang.Class<T2> argType2, Registrar.BinaryFunction<T1,T2> function)
Description copied from interface:Registrar
Adds a binary function to the dispatcher.
-
add
public void add(java.lang.String overloadId, java.util.List<java.lang.Class<?>> argTypes, Registrar.Function function)
Description copied from interface:Registrar
Adds a general function to the dispatcher.
-
dispatch
public java.lang.Object dispatch(Metadata metadata, long exprId, java.lang.String functionName, java.util.List<java.lang.String> overloadIds, java.lang.Object[] args) throws InterpreterException
Description copied from interface:Dispatcher
Invokes a function based on given parameters.- Specified by:
dispatch
in interfaceDispatcher
- Parameters:
metadata
- Metadata used for error reporting.exprId
- Expression identifier which can be used together withmetadata
to get information about the dispatch target for error reporting.functionName
- the logical name of the function being invoked.overloadIds
- A list of function overload ids. The dispatcher selects the unique overload from this list with matching arguments.args
- The arguments to pass to the function.- Returns:
- The result of the function call.
- Throws:
InterpreterException
- if something goes wrong.
-
immutableCopy
public Dispatcher.ImmutableCopy immutableCopy()
Description copied from interface:Dispatcher
Returns anDispatcher.ImmutableCopy
from current instance.- Specified by:
immutableCopy
in interfaceDispatcher
- See Also:
Dispatcher.ImmutableCopy
-
-