Class AbstractCachingScriptEvaluatorFactory
java.lang.Object
org.hibernate.validator.spi.scripting.AbstractCachingScriptEvaluatorFactory
- All Implemented Interfaces:
ScriptEvaluatorFactory
@Incubating
public abstract class AbstractCachingScriptEvaluatorFactory
extends Object
implements ScriptEvaluatorFactory
Basic cacheable factory responsible for the creation of
ScriptEvaluator
s. This
class is thread-safe. Caches ScriptEvaluator
when they are requested.- Since:
- 6.0.3
- Author:
- Gunnar Morling, Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI, Marko Bekhta
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the state of the factory.protected abstract ScriptEvaluator
createNewScriptEvaluator
(String languageName) Creates a new script evaluator for the given language.getScriptEvaluatorByLanguageName
(String languageName) Retrieves a script executor for the given language.
-
Constructor Details
-
AbstractCachingScriptEvaluatorFactory
public AbstractCachingScriptEvaluatorFactory()
-
-
Method Details
-
getScriptEvaluatorByLanguageName
Retrieves a script executor for the given language.- Specified by:
getScriptEvaluatorByLanguageName
in interfaceScriptEvaluatorFactory
- Parameters:
languageName
- the name of a scripting language- Returns:
- a script executor for the given language. Never null.
- Throws:
ScriptEvaluatorNotFoundException
- in case no compatible evaluator for the given language has been found
-
clear
public void clear()Description copied from interface:ScriptEvaluatorFactory
Clear the state of the factory.Called when the
ValidatorFactory
is closed.- Specified by:
clear
in interfaceScriptEvaluatorFactory
-
createNewScriptEvaluator
protected abstract ScriptEvaluator createNewScriptEvaluator(String languageName) throws ScriptEvaluatorNotFoundException Creates a new script evaluator for the given language.- Parameters:
languageName
- the name of a scripting language- Returns:
- a newly created script evaluator for the given language
- Throws:
ScriptEvaluatorNotFoundException
- in case no compatible engine for the given language has been found
-