Class SpringExpressionBiPredicate<T,U>

java.lang.Object
net.shibboleth.shared.spring.expression.AbstractSpringExpressionEvaluator
net.shibboleth.shared.spring.expression.SpringExpressionBiPredicate<T,U>
Type Parameters:
T - first input type
U - second input type
All Implemented Interfaces:
BiPredicate<T,U>

public class SpringExpressionBiPredicate<T,U> extends AbstractSpringExpressionEvaluator implements BiPredicate<T,U>
Predicate whose condition is defined by an Spring EL expression.
Since:
6.1.0
  • Field Details

    • log

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

      @Nullable private Pair<Class<T>,Class<U>> inputTypes
      Input types.
  • Constructor Details

    • SpringExpressionBiPredicate

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

    • getInputTypes

      @Nullable public Pair<Class<T>,Class<U>> getInputTypes()
      Get the input type to be enforced.
      Returns:
      input type
    • setInputTypes

      public void setInputTypes(@Nullable Pair<Class<T>,Class<U>> types)
      Set the input types to be enforced.
      Parameters:
      types - the input types
    • setReturnOnError

      public void setReturnOnError(boolean flag)
      Set value to return if an error occurs.
      Parameters:
      flag - value to return
    • test

      public boolean test(@Nullable T first, @Nullable U second)
      Specified by:
      test in interface BiPredicate<T,U>
    • returnError

      private boolean returnError() throws ClassCastException
      Helper function to sanity check return-on-error object.
      Returns:
      a boolean-valued error fallback
      Throws:
      ClassCastException - if the installed fallback is null or non-Boolean
    • prepareContext

      protected void prepareContext(@Nonnull EvaluationContext context, @Nullable Object... input)
      Pre-process the script context before execution.
      Specified by:
      prepareContext in class AbstractSpringExpressionEvaluator
      Parameters:
      context - the expression context
      input - the inputs