Package net.shibboleth.profile.context.navigate

# Class ScriptedContextLookupFunction<T extends BaseContext>

java.lang.Object
net.shibboleth.shared.scripting.AbstractScriptEvaluator
net.shibboleth.profile.context.navigate.ScriptedContextLookupFunction<T>

Type Parameters:
  `T` - the specific type of context

All Implemented Interfaces:
  `Function<T,Object>`, `ContextDataLookupFunction<T,Object>`

public class ScriptedContextLookupFunction<T extends BaseContext> extends AbstractScriptEvaluator implements ContextDataLookupFunction<T,Object>
A `Function` over a `BaseContext` which calls out to a supplied script.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final Class<T>`
`inputClass`
What class we want the input to test against.

### Fields inherited from class net.shibboleth.shared.scripting.AbstractScriptEvaluator

`DEFAULT_ENGINE`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`ScriptedContextLookupFunction(Class<T> inClass, EvaluableScript theScript)`
Constructor.
`protected`
`ScriptedContextLookupFunction(Class<T> inClass, EvaluableScript theScript, String extraInfo)`
Constructor.
`protected`
`ScriptedContextLookupFunction(Class<T> inClass, EvaluableScript theScript, String extraInfo, Class<?> outputType)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Object`
`apply(T context)`
`Object`
`getCustomObject()`
`static ScriptedContextLookupFunction<MessageContext>`
`inlineMessageContextScript(String scriptSource)`
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from inline data.
`static ScriptedContextLookupFunction<MessageContext>`
`inlineMessageContextScript(String scriptSource, Class<?> outputType)`
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from inline data.
`static ScriptedContextLookupFunction<MessageContext>`
`inlineMessageContextScript(String engineName, String scriptSource)`
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from inline data.
`static ScriptedContextLookupFunction<MessageContext>`
`inlineMessageContextScript(String engineName, String scriptSource, Class<?> outputType)`
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from inline data.
`static ScriptedContextLookupFunction<ProfileRequestContext>`
`inlineScript(String scriptSource)`
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from inline data.
`static ScriptedContextLookupFunction<ProfileRequestContext>`
`inlineScript(String scriptSource, Class<?> outputType)`
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from inline data.
`static ScriptedContextLookupFunction<ProfileRequestContext>`
`inlineScript(String engineName, String scriptSource)`
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from inline data.
`static ScriptedContextLookupFunction<ProfileRequestContext>`
`inlineScript(String engineName, String scriptSource, Class<?> outputType)`
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from inline data.
`protected void`
`prepareContext(ScriptContext scriptContext, Object... input)`
`static ScriptedContextLookupFunction<MessageContext>`
`resourceMessageContextScript(String engineName, Resource resource)`
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from a `Resource`.
`static ScriptedContextLookupFunction<MessageContext>`
`resourceMessageContextScript(String engineName, Resource resource, Class<?> outputType)`
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from a `Resource`.
`static ScriptedContextLookupFunction<MessageContext>`
`resourceMessageContextScript(Resource resource)`
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from a `Resource`.
`static ScriptedContextLookupFunction<MessageContext>`
`resourceMessageContextScript(Resource resource, Class<?> outputType)`
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from a `Resource`.
`static ScriptedContextLookupFunction<ProfileRequestContext>`
`resourceScript(String engineName, Resource resource)`
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from a `Resource`.
`static ScriptedContextLookupFunction<ProfileRequestContext>`
`resourceScript(String engineName, Resource resource, Class<?> outputType)`
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from a `Resource`.
`static ScriptedContextLookupFunction<ProfileRequestContext>`
`resourceScript(Resource resource)`
Factory to create `ScriptedContextLookupFunction` from a `Resource`.
`static ScriptedContextLookupFunction<ProfileRequestContext>`
`resourceScript(Resource resource, Class<?> outputType)`
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from a `Resource`.

### Methods inherited from class net.shibboleth.shared.scripting.AbstractScriptEvaluator

`evaluate, finalizeContext, getHideExceptions, getLogPrefix, getOutputType, getReturnOnError, setContextExtenders, setCustomObject, setHideExceptions, setLogPrefix, 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.Function

`andThen, compose`

## Field Details

### inputClass

@Nonnull private final Class<T extends BaseContext> inputClass
What class we want the input to test against.

## Constructor Details

### ScriptedContextLookupFunction

protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript, @Nullable String extraInfo)
Constructor.

Parameters:
  `inClass` - the class we accept as input.
  `theScript` - the script we will evaluate.
  `extraInfo` - debugging information.

### ScriptedContextLookupFunction

protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript)
Constructor.

Parameters:
  `inClass` - the class we accept as input.
  `theScript` - the script we will evaluate.

### ScriptedContextLookupFunction

protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript, @Nullable String extraInfo, @Nullable Class<?> outputType)
Constructor.

Parameters:
  `inClass` - the class we accept as input.
  `theScript` - the script we will evaluate.
  `extraInfo` - debugging information.
  `outputType` - the type to test against.

## Method Details

### getCustomObject

@Nullable public Object getCustomObject()

Overrides:
  `getCustomObject` in class `AbstractScriptEvaluator`

### apply

public Object apply(@Nullable T context)

Specified by:
  `apply` in interface `Function<T extends BaseContext,Object>`

### prepareContext

protected void prepareContext(@Nonnull ScriptContext scriptContext, @Nullable Object... input)

Specified by:
  `prepareContext` in class `AbstractScriptEvaluator`

### resourceScript

@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @ParameterName(name="resource") Resource resource) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from a `Resource`.

Parameters:
  `resource` - the resource to look at
  `engineName` - the language
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `IOException` - if the file doesn't exist.
  `ComponentInitializationException` - if the scripting initialization fails

### resourceScript

@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @ParameterName(name="resource") Resource resource, @Nullable @ParameterName(name="outputType") Class<?> outputType) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from a `Resource`.

Parameters:
  `resource` - the resource to look at
  `engineName` - the language
  `outputType` - the type to test against.
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `IOException` - if the file doesn't exist.
  `ComponentInitializationException` - if the scripting initialization fails

### resourceScript

@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull @ParameterName(name="resource") Resource resource) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` from a `Resource`.

Parameters:
  `resource` - the resource to look at
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `IOException` - if the file doesn't exist.
  `ComponentInitializationException` - if the scripting initialization fails

### resourceScript

@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull @ParameterName(name="resource") Resource resource, @Nullable @ParameterName(name="outputType") Class<?> outputType) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from a `Resource`.

Parameters:
  `resource` - the resource to look at
  `outputType` - the type to test against.
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `IOException` - if the file doesn't exist.
  `ComponentInitializationException` - if the scripting initialization fails

### inlineScript

@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from inline data.

Parameters:
  `scriptSource` - the script, as a string
  `engineName` - the language
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `ComponentInitializationException` - if the scripting initialization fails

### inlineScript

@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource, @Nullable @ParameterName(name="outputType") Class<?> outputType) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from inline data.

Parameters:
  `scriptSource` - the script, as a string
  `engineName` - the language
  `outputType` - the type to test against.
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `ComponentInitializationException` - if the scripting initialization fails

### inlineScript

@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from inline data.

Parameters:
  `scriptSource` - the script, as a string
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `ComponentInitializationException` - if the scripting initialization fails

### inlineScript

@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource, @Nullable @ParameterName(name="outputType") Class<?> outputType) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `ProfileRequestContext`s from inline data.

Parameters:
  `scriptSource` - the script, as a string
  `outputType` - the type to test against.
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `ComponentInitializationException` - if the scripting initialization fails

### resourceMessageContextScript

@Nonnull public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @ParameterName(name="resource") Resource resource) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from a `Resource`.

Parameters:
  `resource` - the resource to look at
  `engineName` - the language
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `IOException` - if the file doesn't exist.
  `ComponentInitializationException` - if the scripting initialization fails

### resourceMessageContextScript

@Nonnull public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @ParameterName(name="resource") Resource resource, @Nullable @ParameterName(name="outputType") Class<?> outputType) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from a `Resource`.

Parameters:
  `resource` - the resource to look at
  `engineName` - the language
  `outputType` - the type to test against.
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `IOException` - if the file doesn't exist.
  `ComponentInitializationException` - if the scripting initialization fails

### resourceMessageContextScript

@Nonnull public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(@Nonnull @ParameterName(name="resource") Resource resource) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from a `Resource`.

Parameters:
  `resource` - the resource to look at
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `IOException` - if the file doesn't exist.
  `ComponentInitializationException` - if the scripting initialization fails

### resourceMessageContextScript

@Nonnull public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(@Nonnull @ParameterName(name="resource") Resource resource, @Nullable @ParameterName(name="outputType") Class<?> outputType) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from a `Resource`.

Parameters:
  `resource` - the resource to look at
  `outputType` - the type to test against.
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `IOException` - if the file doesn't exist.
  `ComponentInitializationException` - if the scripting initialization fails

### inlineMessageContextScript

@Nonnull public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from inline data.

Parameters:
  `scriptSource` - the script, as a string
  `engineName` - the language
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `ComponentInitializationException` - if the scripting initialization fails

### inlineMessageContextScript

@Nonnull public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty @ParameterName(name="engineName") String engineName, @Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource, @Nullable @ParameterName(name="outputType") Class<?> outputType) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from inline data.

Parameters:
  `scriptSource` - the script, as a string
  `engineName` - the language
  `outputType` - the type to test against.
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `ComponentInitializationException` - if the scripting initialization fails

### inlineMessageContextScript

@Nonnull public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from inline data.

Parameters:
  `scriptSource` - the script, aMessageContexts a string
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `ComponentInitializationException` - if the scripting initialization fails

### inlineMessageContextScript

@Nonnull public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty @ParameterName(name="scriptSource") String scriptSource, @Nullable @ParameterName(name="outputType") Class<?> outputType) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedContextLookupFunction` for `MessageContext`s from inline data.

Parameters:
  `scriptSource` - the script, as a string
  `outputType` - the type to test against.
Returns:
  the function
Throws:
  `ScriptException` - if the compile fails
  `ComponentInitializationException` - if the scripting initialization fails