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:
CandidatesValidator
,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
Modifier and TypeFieldDescriptionprotected I18nizableText
The error text to display if regexp failsprotected boolean
Is the value mandatory ?protected String
The plugin nameprotected Pattern
Does the value need to match a regexpprotected ServiceManager
The service manager -
Constructor Summary
ConstructorDescriptionDefault constructor for avalonDefaultValidator
(String regexp, boolean mandatory) Manual constructorDefaultValidator
(String regexp, I18nizableText invalidText, boolean mandatory) Manual constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration configuration) boolean
Retrieves the configuration of the validator.int
hashCode()
void
service
(ServiceManager smanager) void
setPluginInfo
(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.void
Validates a value.protected void
validateArrayValues
(Object[] values, Errors errors) Validates a array of values.protected void
validateSingleValue
(Object value, Errors errors) 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:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
Description copied from interface:PluginAware
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.- Specified by:
setPluginInfo
in 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:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
getConfiguration
Description copied from interface:Validator
Retrieves the configuration of the validator.- Specified by:
getConfiguration
in interfaceValidator
- Returns:
- a map containing the configuration information.
-
validate
Description copied from interface:Validator
Validates a value. -
validateSingleValue
Validates a single value.- Parameters:
value
- the value to validate (can benull
).errors
- the structure to populate if the validation failed.
-
validateArrayValues
Validates a array of values.- Parameters:
values
- the values to validateerrors
- the structure to populate if the validation failed.
-
hashCode
-
equals
-