Class AbstractSpringExpressionEvaluatorEx

    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • springExpression

        @Nullable
        private String springExpression
        SpEL expression to evaluate.
      • customObject

        @Nullable
        private Object customObject
        A custom object to inject into the expression context.
      • outputType

        @Nullable
        private Class<?> outputType
        The output type.
      • hideExceptions

        private boolean hideExceptions
        Whether to raise runtime exceptions if expression fails.
      • returnOnError

        @Nullable
        private Object returnOnError
        Value to return from predicate when an error occurs.
    • Constructor Detail

      • AbstractSpringExpressionEvaluatorEx

        public AbstractSpringExpressionEvaluatorEx​(@Nonnull @NotEmpty @ParameterName(name="expression")
                                                   String expression)
        Constructor.
        Parameters:
        expression - the expression to evaluate
    • Method Detail

      • getOutputType

        @Nullable
        protected Class<?> getOutputType()
        Get the output type to be enforced.
        Returns:
        output type
      • setOutputType

        protected void setOutputType​(@Nullable
                                     Class<?> type)
        Set the output type to be enforced.
        Parameters:
        type - output type
      • getCustomObject

        @Nullable
        protected Object getCustomObject()
        Get the custom (externally provided) object.
        Returns:
        the custom object
      • setCustomObject

        public void setCustomObject​(@Nullable
                                    Object object)
        Set a custom (externally provided) object.
        Parameters:
        object - the custom object
      • setHideExceptions

        public void setHideExceptions​(boolean flag)
        Set whether to hide exceptions in expression execution (default is false).
        Parameters:
        flag - flag to set
      • getReturnOnError

        @Nullable
        protected Object getReturnOnError()
        Get value to return if an error occurs.
        Returns:
        value to return
      • setReturnOnError

        protected void setReturnOnError​(@Nullable
                                        Object value)
        Set value to return if an error occurs.
        Parameters:
        value - value to return
      • evaluate

        @Nullable
        protected Object evaluate​(@Nullable
                                  Object... input)
        Evaluate the Spring expression on the provided input.
        Parameters:
        input - input arguments
        Returns:
        result of applying the expression to the provided inputs
      • prepareContext

        protected abstract void prepareContext​(@Nonnull
                                               EvaluationContext context,
                                               @Nullable
                                               Object... input)
        Pre-process the script context before execution.
        Parameters:
        context - the expression context
        input - the inputs