Package net.shibboleth.shared.spring.expression

# 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 Summary

Fields
Modifier and Type
Field
Description
`private Pair<Class<T>,Class<U>>`
`inputTypes`
Input types.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`SpringExpressionBiPredicate(String expression)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Pair<Class<T>,Class<U>>`
`getInputTypes()`
Get the input type to be enforced.
`protected void`
`prepareContext(EvaluationContext context, Object... input)`
Pre-process the script context before execution.
`private boolean`
`returnError()`
Helper function to sanity check return-on-error object.
`void`
`setInputTypes(Pair<Class<T>,Class<U>> types)`
Set the input types to be enforced.
`void`
`setReturnOnError(boolean flag)`
Set value to return if an error occurs.
`boolean`
`test(T first, U second)`

### Methods inherited from class net.shibboleth.shared.spring.expression.AbstractSpringExpressionEvaluator

`evaluate, getCustomObject, getOutputType, getReturnOnError, setCustomObject, setHideExceptions, setOutputType, setReturnOnError`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.function.BiPredicate

`and, negate, or`

## 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