Class DefaultValidatorCompoundValueFactory
java.lang.Object
org.tentackle.validate.DefaultValidatorCompoundValueFactory
- All Implemented Interfaces:
ValidatorCompoundValueFactory
@Service(ValidatorCompoundValueFactory.class)
public class DefaultValidatorCompoundValueFactory
extends Object
implements ValidatorCompoundValueFactory
Default compound value factory for validators.
All compound values are created cached and thread-safe. Scripts of the value and condition
parameters are translated by the ValidationScriptConverters, scripts of the message parameter
by the MessageScriptConverters, both selected by the scripting language.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates the factory.
Loads the message and validation script converters. -
Method Summary
Modifier and TypeMethodDescriptionprotected CompoundValuecreateCompoundValue(String value, Class<?> clazz, Function<String, ScriptConverter> scriptConverterProvider) Creates a compound value.
The compound value is always created cached and for thread-safe execution.createConditionParameter(String condition) Creates the compound value for the condition parameter.createMessageParameter(String message) Creates the compound value for the message parameter.createValueParameter(String value, Class<?> clazz) Creates the compound value for the value parameter.
-
Constructor Details
-
DefaultValidatorCompoundValueFactory
public DefaultValidatorCompoundValueFactory()Creates the factory.
Loads the message and validation script converters.- Throws:
ValidationRuntimeException- if a script converter could not be instantiated
-
-
Method Details
-
createValueParameter
Description copied from interface:ValidatorCompoundValueFactoryCreates the compound value for the value parameter.- Specified by:
createValueParameterin interfaceValidatorCompoundValueFactory- Parameters:
value- the value from the annotationclazz- the type of the value- Returns:
- the created compound value
-
createConditionParameter
Description copied from interface:ValidatorCompoundValueFactoryCreates the compound value for the condition parameter.- Specified by:
createConditionParameterin interfaceValidatorCompoundValueFactory- Parameters:
condition- the condition text from the annotation- Returns:
- the created compound value of type
Boolean
-
createMessageParameter
Description copied from interface:ValidatorCompoundValueFactoryCreates the compound value for the message parameter.- Specified by:
createMessageParameterin interfaceValidatorCompoundValueFactory- Parameters:
message- the message text from the annotation- Returns:
- the created compound value
-
createCompoundValue
protected CompoundValue createCompoundValue(String value, Class<?> clazz, Function<String, ScriptConverter> scriptConverterProvider) Creates a compound value.
The compound value is always created cached and for thread-safe execution.- Parameters:
value- the string valueclazz- the class of the valuescriptConverterProvider- the optional script converter provider- Returns:
- the compound value
-