public class DefaultValidator extends AbstractLogEnabled implements Validator, Configurable, PluginAware, Serviceable
| Modifier and Type | Field and Description |
|---|---|
protected I18nizableText |
_invalidText
The error text to display if regexp fails
|
protected boolean |
_isMandatory
Is the value mandatory ?
|
private JSONUtils |
_jsonUtils |
protected String |
_pluginName
The plugin name
|
protected Pattern |
_regexp
Does the value need to match a regexp
|
protected ServiceManager |
_smanager
The service manager
|
| Constructor and Description |
|---|
DefaultValidator()
Default constructor for avalon
|
DefaultValidator(String regexp,
boolean mandatory)
Manual constructor
|
DefaultValidator(String regexp,
I18nizableText invalidText,
boolean mandatory)
Manual constructor
|
| Modifier and Type | Method and Description |
|---|---|
private boolean |
_matchRegexp(Object[] values) |
void |
configure(Configuration configuration) |
Map<String,Object> |
getConfiguration()
Retrieves the configuration of the validator.
|
void |
saxConfiguration(ContentHandler handler)
Sax the configuration of the validator to allow the client side to prevalidate
|
protected void |
saxJsonConfig(ContentHandler handler)
SAX the JSON configuration of this validator
|
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. |
Map<String,Object> |
toJson()
Returns a object representing the validator able to be converted into a JSON string
|
void |
validate(Object value,
Errors errors)
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.
|
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerprotected boolean _isMandatory
protected I18nizableText _invalidText
protected String _pluginName
protected ServiceManager _smanager
private JSONUtils _jsonUtils
public DefaultValidator()
public DefaultValidator(String regexp, boolean mandatory)
regexp - The regexp to check or nullmandatory - Is the value mandatorypublic DefaultValidator(String regexp, I18nizableText invalidText, boolean mandatory)
regexp - The regexp to check or nullinvalidText - The error text to displaymandatory - Is the value mandatorypublic void service(ServiceManager smanager) throws ServiceException
service in interface ServiceableServiceExceptionpublic void setPluginInfo(String pluginName, String featureName, String id)
PluginAwaresetPluginInfo in interface PluginAwarepluginName - Unique identifier for the plugin hosting the extensionfeatureName - Unique feature identifier (unique for a given pluginName)id - Unique identifier of this componentpublic void configure(Configuration configuration) throws ConfigurationException
configure in interface ConfigurableConfigurationExceptionpublic Map<String,Object> toJson()
Validatorprotected void saxJsonConfig(ContentHandler handler) throws SAXException
handler - The content handlet to sax intoSAXException - if an error occurredpublic void saxConfiguration(ContentHandler handler) throws SAXException
ValidatorsaxConfiguration in interface Validatorhandler - The content handler where to sax parametersSAXException - if an error occuredpublic Map<String,Object> getConfiguration()
ValidatorValidator.saxConfiguration(ContentHandler)getConfiguration in interface Validatorpublic void validate(Object value, Errors errors)
Validatorprotected void validateSingleValue(Object value, Errors errors)
value - the value to validate (can be null).errors - the structure to populate if the validation failed.protected void validateArrayValues(Object[] values, Errors errors)
values - the values to validateerrors - the structure to populate if the validation failed.private boolean _matchRegexp(Object[] values)