public class ValidatorMandatory extends AbstractValueValidator<Object>
ValueValidator that validates that a mandatory value is filled. It
will produce a ValidationFailure if the value is not provided (empty, blank,
null).| Modifier and Type | Field and Description |
|---|---|
static String |
CODE |
private static ValidatorMandatory |
INSTANCE |
PROPERTY_MANDATORY, PROPERTY_MAXIMUM, PROPERTY_MINIMUM| Constructor and Description |
|---|
ValidatorMandatory()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
protected String |
getCode()
This is the default implementation to retrieve the
code of this
ValueValidator. |
private NlsMessage |
getFailureMessage() |
static ValidatorMandatory |
getInstance() |
<P> P |
getProperty(TypedProperty<P> property)
Gets the value of a property.
|
int |
hashCode() |
protected NlsMessage |
validateNotNull(Object value)
This method performs the validation in case
value is NOT null. |
protected NlsMessage |
validateNull()
This method performs the validation in case
null was provided as value. |
validateappend, contains, createBundle, isDynamic, isMandatory, validatepublic static final String CODE
getCode(),
Constant Field Valuesprivate static final ValidatorMandatory INSTANCE
protected String getCode()
AbstractValidatorcode 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.getCode in class AbstractValidator<Object>code.public static ValidatorMandatory getInstance()
protected NlsMessage validateNull()
AbstractValueValidatornull was provided as value. By default null should be
considered as a legal value. Only for validators such as ValidatorMandatory this method should be
overridden.validateNull in class AbstractValueValidator<Object>failure message or null if the null -value is
valid.private NlsMessage getFailureMessage()
protected NlsMessage validateNotNull(Object value)
AbstractValueValidatorvalue is NOT null. This method contains the actual
custom logic for the validation. It is therefore designed in a way that makes it most simple to implement custom
validators. NlsMessage instead.validateNotNull in class AbstractValueValidator<Object>value - is the value to validate.failure message or null if the the given value
is valid.public <P> P getProperty(TypedProperty<P> property)
AbstractValidatorgetProperty in class AbstractValidator<Object>P - the generic type of the requested property.property - the TypedProperty.null if undefined.public int hashCode()
hashCode in class AbstractValidator<Object>public boolean equals(Object obj)
equals in class AbstractValidator<Object>Copyright © 2001–2016 mmm-Team. All rights reserved.