T - input typeU - output typepublic class ScriptedFunction<T,U> extends AbstractScriptEvaluator implements com.google.common.base.Function<T,U>
Function which calls out to a supplied script.| Modifier and Type | Field and Description |
|---|---|
private Class<T> |
inputTypeClass
Input Type.
|
private org.slf4j.Logger |
log
Class logger.
|
DEFAULT_ENGINE| Modifier | Constructor and Description |
|---|---|
protected |
ScriptedFunction(EvaluableScript theScript)
Constructor.
|
protected |
ScriptedFunction(EvaluableScript theScript,
String extraInfo)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
U |
apply(T input) |
Class |
getInputType()
Get the input type to be enforced.
|
(package private) static ScriptedFunction |
inlineScript(String scriptSource)
Factory to create
ScriptedFunction from inline data. |
(package private) static ScriptedFunction |
inlineScript(String engineName,
String scriptSource)
Factory to create
ScriptedFunction from inline data. |
protected void |
prepareContext(ScriptContext scriptContext,
Object... input)
Pre-process the script context before execution.
|
(package private) static ScriptedFunction |
resourceScript(Resource resource)
Factory to create
ScriptedFunction from a Resource. |
(package private) static ScriptedFunction |
resourceScript(String engineName,
Resource resource)
Factory to create
ScriptedFunction from a Resource. |
void |
setInputType(Class 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.
|
evaluate, finalizeContext, getCustomObject, getHideExceptions, getLogPrefix, getOutputType, getReturnOnError, setCustomObject, setHideExceptions, setLogPrefix@Nonnull private final org.slf4j.Logger log
protected ScriptedFunction(@Nonnull@NotEmpty@ParameterName(name="theScript") EvaluableScript theScript, @Nullable@NotEmpty@ParameterName(name="extraInfo") String extraInfo)
theScript - the script we will evaluate.extraInfo - debugging information.protected ScriptedFunction(@Nonnull@NotEmpty@ParameterName(name="theScript") EvaluableScript theScript)
theScript - the script we will evaluate.public void setOutputType(@Nullable Class type)
setOutputType in class AbstractScriptEvaluatortype - output type@Nullable public Class getInputType()
public void setInputType(@Nullable Class type)
type - input typepublic void setReturnOnError(@Nullable Object value)
setReturnOnError in class AbstractScriptEvaluatorvalue - value to returnprotected void prepareContext(@Nonnull ScriptContext scriptContext, @Nullable Object... input)
prepareContext in class AbstractScriptEvaluatorscriptContext - the script contextinput - the inputstatic ScriptedFunction resourceScript(@Nonnull@NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException
ScriptedFunction from a Resource.resource - the resource to look atengineName - the languageScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedFunction resourceScript(Resource resource) throws ScriptException, IOException
ScriptedFunction from a Resource.resource - the resource to look atScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedFunction inlineScript(@Nonnull@NotEmpty String engineName, @Nonnull@NotEmpty String scriptSource) throws ScriptException
ScriptedFunction from inline data.scriptSource - the script, as a stringengineName - the languageScriptException - if the compile failsstatic ScriptedFunction inlineScript(@Nonnull@NotEmpty String scriptSource) throws ScriptException
ScriptedFunction from inline data.scriptSource - the script, as a stringScriptException - if the compile failsCopyright © 1999–2019 Shibboleth Consortium. All rights reserved.