Package net.shibboleth.profile.context.logic

# Class ScriptedPredicate

java.lang.Object
net.shibboleth.shared.scripting.AbstractScriptEvaluator
net.shibboleth.shared.logic.ScriptedPredicate<ProfileRequestContext>
net.shibboleth.profile.context.logic.ScriptedPredicate

All Implemented Interfaces:
  `Predicate<ProfileRequestContext>`

public class ScriptedPredicate extends ScriptedPredicate<ProfileRequestContext>
A `Predicate` which calls out to a supplied script.

## Field Summary

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

`DEFAULT_ENGINE`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`ScriptedPredicate(EvaluableScript theScript)`
Constructor.
`protected`
`ScriptedPredicate(EvaluableScript theScript, String extraInfo)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static ScriptedPredicate`
`inlineScript(String scriptSource)`
Factory to create `ScriptedPredicate` from inline data.
`static ScriptedPredicate`
`inlineScript(String engineName, String scriptSource)`
Factory to create `ScriptedPredicate` from inline data.
`protected void`
`prepareContext(ScriptContext scriptContext, Object... input)`
`static ScriptedPredicate`
`resourceScript(String engineName, Resource resource)`
Factory to create `ScriptedPredicate` from a `Resource`.
`static ScriptedPredicate`
`resourceScript(Resource resource)`
Factory to create `ScriptedPredicate` from a `Resource`.

### Methods inherited from class net.shibboleth.shared.logic.ScriptedPredicate

`getInputType, setInputType, setReturnOnError, test`

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

`evaluate, finalizeContext, getCustomObject, 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.Predicate

`and, negate, or`

## Constructor Details

### ScriptedPredicate

protected ScriptedPredicate(@Nonnull @NotEmpty @ParameterName(name="theScript") EvaluableScript theScript, @Nullable @NotEmpty @ParameterName(name="extraInfo") String extraInfo)
Constructor.

Parameters:
  `theScript` - the script we will evaluate.
  `extraInfo` - debugging information.

### ScriptedPredicate

protected ScriptedPredicate(@Nonnull @NotEmpty @ParameterName(name="theScript") EvaluableScript theScript)
Constructor.

Parameters:
  `theScript` - the script we will evaluate.

## Method Details

### prepareContext

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

Overrides:
  `prepareContext` in class `ScriptedPredicate<ProfileRequestContext>`

### resourceScript

@Nonnull public static ScriptedPredicate resourceScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedPredicate` from a `Resource`.

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

### resourceScript

@Nonnull public static ScriptedPredicate resourceScript(@Nonnull Resource resource) throws ScriptException, IOException, ComponentInitializationException
Factory to create `ScriptedPredicate` from a `Resource`.

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

### inlineScript

@Nonnull public static ScriptedPredicate inlineScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedPredicate` from inline data.

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

### inlineScript

@Nonnull public static ScriptedPredicate inlineScript(@Nonnull @NotEmpty String scriptSource) throws ScriptException, ComponentInitializationException
Factory to create `ScriptedPredicate` from inline data.

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