Package net.shibboleth.shared.spring.expression

# Class SpringExpressionFunction<T,U>

java.lang.Object
net.shibboleth.shared.spring.expression.AbstractSpringExpressionEvaluator
net.shibboleth.shared.spring.expression.SpringExpressionFunction<T,U>

Type Parameters:
  `T` - type of input
  `U` - type of output

All Implemented Interfaces:
  `Function<T,U>`

public class SpringExpressionFunction<T,U> extends AbstractSpringExpressionEvaluator implements Function<T,U>
Function whose output is defined by an Spring EL expression.

Since:
  5.4.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private Class<T>`
`inputType`
The input type.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`U`
`apply(T input)`
`Class<T>`
`getInputType()`
Get the input type to be enforced.
`protected void`
`prepareContext(EvaluationContext context, Object... input)`
Pre-process the script context before execution.
`void`
`setInputType(Class<T> type)`
Set the input type to be enforced.
`void`
`setOutputType(Class<?> type)`
Set the output type to be enforced.
`void`
`setReturnOnError(Object value)`
Set value to return if an error occurs.

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

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

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

`andThen, compose`

## Field Details

### log

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

### inputType

@Nullable private Class<T> inputType
The input type.

## Constructor Details

### SpringExpressionFunction

public SpringExpressionFunction(@Nonnull @NotEmpty @ParameterName(name="expression") String expression)
Constructor.

Parameters:
  `expression` - the expression to evaluate

## Method Details

### getInputType

@Nullable public Class<T> getInputType()
Get the input type to be enforced.

Returns:
  input type

### setInputType

public void setInputType(@Nullable Class<T> type)
Set the input type to be enforced.

Parameters:
  `type` - input type

### setOutputType

public void setOutputType(@Nullable Class<?> type)
Set the output type to be enforced.

Overrides:
  `setOutputType` in class `AbstractSpringExpressionEvaluator`
Parameters:
  `type` - output type

### setReturnOnError

public void setReturnOnError(@Nullable Object value)
Set value to return if an error occurs.

Overrides:
  `setReturnOnError` in class `AbstractSpringExpressionEvaluator`
Parameters:
  `value` - value to return

### apply

public U apply(@Nullable T input)

Specified by:
  `apply` in interface `Function<T,U>`

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