Class ValidatorCollectionSize
- java.lang.Object
-
- io.github.mmm.validation.AbstractValidator<V>
-
- io.github.mmm.validation.AbstractValueValidator<V>
-
- io.github.mmm.validation.main.AbstractValidatorRange<Collection<?>,Number>
-
- io.github.mmm.validation.collection.ValidatorCollectionSize
-
- All Implemented Interfaces:
Composable<Validator<?>>
,Validator<Collection<?>>
,Iterable<Validator<?>>
public class ValidatorCollectionSize extends AbstractValidatorRange<Collection<?>,Number>
- Since:
- 1.0.0
-
-
Field Summary
-
Fields inherited from class io.github.mmm.validation.main.AbstractValidatorRange
ID, range
-
Fields inherited from interface io.github.mmm.validation.Validator
ID_MANDATORY
-
-
Constructor Summary
Constructors Constructor Description ValidatorCollectionSize(int maxLength)
The constructor.ValidatorCollectionSize(Range<Number> range)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Integer
convertValue(Collection<?> value)
Converts the value to the type of the range.protected boolean
isLength()
-
Methods inherited from class io.github.mmm.validation.main.AbstractValidatorRange
equals, getId, getRange, hashCode, validateNotNull
-
Methods inherited from class io.github.mmm.validation.AbstractValueValidator
validate, validateNull
-
Methods inherited from class io.github.mmm.validation.AbstractValidator
isDynamic, source2string, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.base.lang.Composable
getChild, getChildCount, iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface io.github.mmm.validation.Validator
append, append, containsId, getMax, getMin, isMandatory, validate
-
-
-
-
Constructor Detail
-
ValidatorCollectionSize
public ValidatorCollectionSize(Range<Number> range)
The constructor.- Parameters:
range
- is theRange
the value has to becontained in
.
-
ValidatorCollectionSize
public ValidatorCollectionSize(int maxLength)
The constructor.- Parameters:
maxLength
- themaximum
size
allowed for theCollection
values.
-
-
Method Detail
-
convertValue
protected Integer convertValue(Collection<?> value)
Description copied from class:AbstractValidatorRange
Converts the value to the type of the range.- Overrides:
convertValue
in classAbstractValidatorRange<Collection<?>,Number>
- Parameters:
value
- is the value to convert.- Returns:
- the converted value.
-
isLength
protected boolean isLength()
- Overrides:
isLength
in classAbstractValidatorRange<Collection<?>,Number>
- Returns:
true
if validating the lenght of the value,false
otherwise.
-
-