Package org.ametys.runtime.parameter
Class DefaultValidator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.runtime.parameter.DefaultValidator
- All Implemented Interfaces:
Validator,PluginAware,Configurable,LogEnabled,Serviceable
- Direct Known Subclasses:
AbstractIntervalFormValidator,CandidatesValidator,FileFormValidator,FileValidator,NameForFormValidator,ReferenceValidator,RegexpValidator,SQLDatabaseTypeValidator,TextValidator
public class DefaultValidator
extends AbstractLogEnabled
implements Validator, Configurable, PluginAware, Serviceable
This default implementation validates the following configurable stuff:
- mandatory: check the parameter is set
- regexp: check the string parameter matches a regexp
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected I18nizableTextThe error text to display if regexp failsprotected booleanIs the value mandatory ?protected StringThe plugin nameprotected PatternDoes the value need to match a regexpprotected ServiceManagerThe service manager -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for avalonDefaultValidator(String regexp, boolean mandatory) Manual constructorDefaultValidator(String regexp, I18nizableText invalidText, boolean mandatory) Manual constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Configuration configuration) booleanRetrieves the configuration of the validator.inthashCode()voidservice(ServiceManager smanager) voidsetPluginInfo(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.Validates a value.protected ValidationResultvalidateArrayValues(Object[] values) Validates a array of values.protected ValidationResultvalidateSingleValue(Object value) Validates a single value.Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_isMandatory
Is the value mandatory ? -
_regexp
Does the value need to match a regexp -
_invalidText
The error text to display if regexp fails -
_pluginName
The plugin name -
_smanager
The service manager
-
-
Constructor Details
-
DefaultValidator
public DefaultValidator()Default constructor for avalon -
DefaultValidator
Manual constructor- Parameters:
regexp- The regexp to check or nullmandatory- Is the value mandatory
-
DefaultValidator
Manual constructor- Parameters:
regexp- The regexp to check or nullinvalidText- The error text to displaymandatory- Is the value mandatory
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
setPluginInfo
Description copied from interface:PluginAwareSets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfoin interfacePluginAware- Parameters:
pluginName- Unique identifier for the plugin hosting the extensionfeatureName- Unique feature identifier (unique for a given pluginName)id- Unique identifier of this component
-
configure
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
getConfiguration
Description copied from interface:ValidatorRetrieves the configuration of the validator.- Specified by:
getConfigurationin interfaceValidator- Returns:
- a map containing the configuration information.
-
validate
Description copied from interface:ValidatorValidates a value. -
validateSingleValue
Validates a single value.- Parameters:
value- the value to validate (can benull).- Returns:
- the validation result
-
validateArrayValues
Validates a array of values.- Parameters:
values- the values to validate- Returns:
- the validation result
-
hashCode
-
equals
-