Class TextValidator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.runtime.parameter.DefaultValidator
-
- org.ametys.plugins.core.parameter.TextValidator
-
- All Implemented Interfaces:
Validator
,PluginAware
,Configurable
,LogEnabled
,Serviceable
- Direct Known Subclasses:
RichTextValidator
public class TextValidator extends DefaultValidator
Implements the same configuration as the DefaultValidator and also handle a <maxlength> parameter that allows a max count of chars
-
-
Field Summary
Fields Modifier and Type Field Description protected Integer
_maxLength
Does the value has a max length-
Fields inherited from class org.ametys.runtime.parameter.DefaultValidator
_invalidText, _isMandatory, _pluginName, _regexp, _smanager
-
-
Constructor Summary
Constructors Constructor Description TextValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Configuration configuration)
Map<String,Object>
getConfiguration()
Retrieves the configuration of the validator.protected String
getText(Object value)
Get the textprotected 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.ametys.runtime.parameter.DefaultValidator
equals, hashCode, service, setPluginInfo, validate
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_maxLength
protected Integer _maxLength
Does the value has a max length
-
-
Constructor Detail
-
TextValidator
public TextValidator()
-
-
Method Detail
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultValidator
- Throws:
ConfigurationException
-
getConfiguration
public Map<String,Object> getConfiguration()
Description copied from interface:Validator
Retrieves the configuration of the validator.- Specified by:
getConfiguration
in interfaceValidator
- Overrides:
getConfiguration
in classDefaultValidator
- Returns:
- a map containing the configuration information.
-
validateSingleValue
protected void validateSingleValue(Object value, Errors errors)
Description copied from class:DefaultValidator
Validates a single value.- Overrides:
validateSingleValue
in classDefaultValidator
- Parameters:
value
- the value to validate (can benull
).errors
- the structure to populate if the validation failed.
-
validateArrayValues
protected void validateArrayValues(Object[] values, Errors errors)
Description copied from class:DefaultValidator
Validates a array of values.- Overrides:
validateArrayValues
in classDefaultValidator
- Parameters:
values
- the values to validateerrors
- the structure to populate if the validation failed.
-
-