VALUE
- is the generic type of the value
.public abstract class AbstractUiFeatureValueAndValidationWithValidators<VALUE> extends AbstractUiFeatureValueAndValidation<VALUE>
AbstractUiFeatureValueAndValidation
with the validators.Modifier and Type | Field and Description |
---|---|
private boolean |
mandatory |
private List<ValueValidator<? super VALUE>> |
validatorList |
Constructor and Description |
---|
AbstractUiFeatureValueAndValidationWithValidators()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addValidator(ValueValidator<? super VALUE> validator)
This method adds the given
ValueValidator to this object. |
boolean |
doValidate(ValidationState state,
VALUE value)
This method performs the actual validation using the
registered validators. |
private void |
ensureValidatorList()
Ensures that the validator
List is already created. |
boolean |
isMandatory()
This method determines if
ValidatorMandatory (or a sub-class) has
been added to this object. |
protected boolean |
isMandatory(ValueValidator<?> validator)
Determines the given
validator is mandatory. |
boolean |
removeValidator(ValueValidator<? super VALUE> validator)
This method removes the given
ValueValidator from this object. |
protected void |
setMandatory(boolean mandatory) |
addValidatorMandatory, clearValidity, createValidationFailure, getLogger, getSource, getValue, getValueAndValidate, getValueOrException, handleGetValueError, resetValue, setValue, setValueForUser, toString, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getValueDirect
addChangeHandler, removeChangeHandler
setValue
getOriginalValue
private List<ValueValidator<? super VALUE>> validatorList
addValidator(ValueValidator)
private boolean mandatory
isMandatory()
public AbstractUiFeatureValueAndValidationWithValidators()
public final boolean isMandatory()
ValidatorMandatory
(or a sub-class) has
been added
to this object.true
if this the value
of this object is mandatory.protected void setMandatory(boolean mandatory)
mandatory
- is the mandatory to setpublic final void addValidator(ValueValidator<? super VALUE> validator)
ValueValidator
to this object. All ValueValidator
s are
invoked
in the same order as they are added by this method. They are
invoked
no matter if the previous ValueValidator
s failed or
succeeded. You should always design ValueValidator
s in a robust and reusable way (e.g. a range validator
should accept null
as valid input so it can be used for both mandatory and optional fields).validator
- is the ValueValidator
to add.protected boolean isMandatory(ValueValidator<?> validator)
validator
is mandatory.validator
- the given ValueValidator
.true
if the given validator
is mandatory
.private void ensureValidatorList()
List
is already created.public final boolean removeValidator(ValueValidator<? super VALUE> validator)
ValueValidator
from this object. validator
- is the ValueValidator
to remove.true
if the ValueValidator
has actually been removed, false
otherwise (it has NOT
previously been added
).public final boolean doValidate(ValidationState state, VALUE value)
registered
validators. It is (indirectly)
called from AbstractUiFeatureValueAndValidation.validate(ValidationState)
.state
- is the ValidationState
. Must NOT be null
.value
- is the current value
of this object that has already be determined.true
if the validation was successful, false
otherwise (if there are validation
failures).Copyright © 2001–2016 mmm-Team. All rights reserved.