Class DefaultDispatcher

    • Method Detail

      • create

        @Deprecated
        public static DefaultDispatcher create()
        Deprecated.
        Migrate to fluent APIs. See CelRuntimeFactory.
        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. See CelRuntimeFactory.
        Creates a new dispatcher with all standard functions.
      • 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.
        Specified by:
        add in interface Registrar
      • 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.
        Specified by:
        add in interface Registrar
      • 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.
        Specified by:
        add in interface Registrar
      • 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 interface Dispatcher
        Parameters:
        metadata - Metadata used for error reporting.
        exprId - Expression identifier which can be used together with metadata 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.