V - is the generic type of the value to validate.public class ValidatorCompare<V extends Comparable<V>> extends AbstractValueValidator<V>
ValueValidator that validates that
a value is satisfies a given CompareOperator -operation for
given value to compare to.| Modifier and Type | Field and Description |
|---|---|
private CompareOperator |
comparator
The comparison operator.
|
private boolean |
dynamic |
private String |
source |
private AttributeReadValue<V> |
valueSource |
| Constructor and Description |
|---|
ValidatorCompare(CompareOperator comparator,
AttributeReadValue<V> valueSource,
String source)
The constructor.
|
ValidatorCompare(CompareOperator comparator,
V value)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isDynamic()
This method determines if this
ValueValidator is dynamic. |
protected NlsMessage |
validateNotNull(V value)
This method performs the validation in case
value is NOT null. |
validate, validateNullcreateBundle, getCode, isMandatory, validateprivate final CompareOperator comparator
private final AttributeReadValue<V extends Comparable<V>> valueSource
validateNotNull(Comparable)private final String source
validateNotNull(Comparable)private final boolean dynamic
isDynamic()public ValidatorCompare(CompareOperator comparator, AttributeReadValue<V> valueSource, String source)
comparator - is the comparison operator used to compare the value to validate (first argument) with the value of the given valueSource.valueSource - is a reference to something that provides a value and will
be evaluated dynamically on every validation.source - is a brief description of the valueSource for potential failure messages. E.g. in case
of a user interface the label of the field providing the value. May be null.public ValidatorCompare(CompareOperator comparator, V value)
comparator - is the comparison operator used to compare the value to validate (first argument) with the value of the given value.value - is the fixed value to compare to.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).isDynamic in class AbstractValidator<V extends Comparable<V>>true if this ValueValidator is dynamic, false otherwise.protected NlsMessage validateNotNull(V value)
value 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<V extends Comparable<V>>value - is the value to validate.failure message or null if the the given
value is valid.Copyright © 2001–2015 mmm-Team. All rights reserved.