V
- is the generic type of the value to validate
.public abstract class AbstractValidator<V> extends Object implements ValueValidator<V>
ValueValidator
implementations should extend.Constructor and Description |
---|
AbstractValidator()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected <BUNDLE extends NlsBundle> |
createBundle(Class<BUNDLE> bundleInterface)
This is a convenience method delegating to
NlsBundleFactory.createBundle(Class) . |
protected String |
getCode()
This is the default implementation to retrieve the
code of this
ValueValidator . |
boolean |
isDynamic()
This method determines if this
ValueValidator is dynamic. |
boolean |
isMandatory() |
ValidationFailure |
validate(V value)
This method validates the given
value . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
validate
protected String getCode()
code
of this
ValueValidator
. classname
of the actual
ValueValidator
implementation. This strategy is chosen for simplicity when implementing a new validator. To
ensure stable codes override this method and return a string constant. This shall at least be done when the name of
the class is changed.code
.public final ValidationFailure validate(V value)
value
.validate
in interface ValueValidator<V>
value
- is the value to validate.ValidationFailure
or null
if the given value
is valid
according to this ValueValidator
.public boolean isDynamic()
ValueValidator
is dynamic. Here dynamic means that the validation
of the same input may not always return the same validation result (e.g. it holds references to instances that have
dynamic impact on the validation).true
if this ValueValidator
is dynamic, false
otherwise.public boolean isMandatory()
true
if this is a validator for mandatory fields (that will not accept null
or
empty values), false
otherwise.protected <BUNDLE extends NlsBundle> BUNDLE createBundle(Class<BUNDLE> bundleInterface)
NlsBundleFactory.createBundle(Class)
.Copyright © 2001–2014 mmm-Team. All rights reserved.