V
- the generic type of the value to validate
.R
- the generic type of the Range
-bounds.public class AbstractValidatorRange<V,R> extends AbstractValueValidator<V>
ValueValidator
validating
that a
given value is contained
in a given Range
.Modifier and Type | Field and Description |
---|---|
static String |
CODE |
private Range<R> |
range |
PROPERTY_MANDATORY, PROPERTY_MAXIMUM, PROPERTY_MINIMUM
Constructor and Description |
---|
AbstractValidatorRange(Range<R> range)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected R |
convertValue(V value)
Converts the value to the type of the range.
|
boolean |
equals(Object obj) |
protected String |
getCode()
This is the default implementation to retrieve the
code of this
ValueValidator . |
<P> P |
getProperty(TypedProperty<P> property)
Gets the value of a property.
|
int |
hashCode() |
protected NlsMessage |
validateNotNull(V value)
This method performs the validation in case
value is NOT null . |
validate, validateNull
append, contains, createBundle, isDynamic, isMandatory, validate
public static final String CODE
getCode()
,
Constant Field Valuespublic AbstractValidatorRange(Range<R> range)
range
- is the Range
the value has to be contained in
.protected String getCode()
AbstractValidator
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.getCode
in class AbstractValidator<V>
code
.protected R convertValue(V value)
value
- is the value to convert.protected NlsMessage validateNotNull(V value)
AbstractValueValidator
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>
value
- is the value to validate.failure message
or null
if the the given value
is valid.public <P> P getProperty(TypedProperty<P> property)
AbstractValidator
getProperty
in class AbstractValidator<V>
P
- the generic type of the requested property.property
- the TypedProperty
.null
if undefined.public int hashCode()
hashCode
in class AbstractValidator<V>
public boolean equals(Object obj)
equals
in class AbstractValidator<V>
Copyright © 2001–2016 mmm-Team. All rights reserved.