T - input typepublic class ScriptedPredicate<T> extends AbstractScriptEvaluator implements com.google.common.base.Predicate<T>
Predicate which calls out to a supplied script.| Modifier and Type | Field and Description |
|---|---|
private org.slf4j.Logger |
log
Class logger.
|
DEFAULT_ENGINE| Modifier | Constructor and Description |
|---|---|
protected |
ScriptedPredicate(EvaluableScript theScript)
Constructor.
|
protected |
ScriptedPredicate(EvaluableScript theScript,
String extraInfo)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(T input) |
(package private) static ScriptedPredicate |
inlineScript(String scriptSource)
Factory to create
ScriptedPredicate from inline data. |
(package private) static ScriptedPredicate |
inlineScript(String engineName,
String scriptSource)
Factory to create
ScriptedPredicate from inline data. |
protected void |
prepareContext(ScriptContext scriptContext,
Object... input)
Pre-process the script context before execution.
|
(package private) static ScriptedPredicate |
resourceScript(Resource resource)
Factory to create
ScriptedPredicate from a Resource. |
(package private) static ScriptedPredicate |
resourceScript(String engineName,
Resource resource)
Factory to create
ScriptedPredicate from a Resource. |
void |
setReturnOnError(boolean flag)
Set value to return if an error occurs.
|
evaluate, finalizeContext, getCustomObject, getHideExceptions, getLogPrefix, getOutputType, getReturnOnError, setCustomObject, setHideExceptions, setLogPrefix, setOutputType, setReturnOnError@Nonnull private final org.slf4j.Logger log
protected ScriptedPredicate(@Nonnull @NotEmpty @ParameterName(name="theScript") EvaluableScript theScript, @Nullable @NotEmpty @ParameterName(name="extraInfo") String extraInfo)
theScript - the script we will evaluate.extraInfo - debugging information.protected ScriptedPredicate(@Nonnull @NotEmpty @ParameterName(name="theScript") EvaluableScript theScript)
theScript - the script we will evaluate.public void setReturnOnError(boolean flag)
flag - value to returnpublic boolean apply(@Nullable T input)
apply in interface com.google.common.base.Predicate<T>protected void prepareContext(@Nonnull ScriptContext scriptContext, @Nullable Object... input)
prepareContext in class AbstractScriptEvaluatorscriptContext - the script contextinput - the inputstatic ScriptedPredicate resourceScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException
ScriptedPredicate from a Resource.resource - the resource to look atengineName - the languageScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedPredicate resourceScript(Resource resource) throws ScriptException, IOException
ScriptedPredicate from a Resource.resource - the resource to look atScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedPredicate inlineScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource) throws ScriptException
ScriptedPredicate from inline data.scriptSource - the script, as a stringengineName - the languageScriptException - if the compile failsstatic ScriptedPredicate inlineScript(@Nonnull @NotEmpty String scriptSource) throws ScriptException
ScriptedPredicate from inline data.scriptSource - the script, as a stringScriptException - if the compile failsCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.