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 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 |
PROPERTY_MANDATORY, PROPERTY_MAXIMUM, PROPERTY_MINIMUM| 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 |
equals(Object obj) |
int |
hashCode() |
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, validateNullappend, contains, createBundle, getCode, getProperty, isMandatory, validateprivate final CompareOperator comparator
private final AttributeReadValue<V extends Comparable<V>> valueSource
private final String source
private final boolean dynamic
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()
AbstractValidatorValueValidator 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)
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<V extends Comparable<V>>value - is the value to validate.failure message or null if the the given value
is valid.public int hashCode()
hashCode in class AbstractValidator<V extends Comparable<V>>public boolean equals(Object obj)
equals in class AbstractValidator<V extends Comparable<V>>Copyright © 2001–2016 mmm-Team. All rights reserved.