|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.smartics.properties.spi.core.constraint.AbstractPropertyConstraint<List<?>> de.smartics.properties.spi.core.constraints.ListValueConstraint
@ThreadSafe public final class ListValueConstraint
A constraint that requires a value to be a list.
Constructor Summary | |
---|---|
ListValueConstraint() Convenience constructor for elements of type String without any constraints. |
|
ListValueConstraint(Class<?> elementType) Convenience constructor if there are no constraints, neither on the number of list elements nor any other. |
|
ListValueConstraint(Class<?> elementType, Integer minOccurs, Integer maxOccurs) Convenience constructor if there are no constraints. |
|
ListValueConstraint(Class<?> elementType, Integer minOccurs, Integer maxOccurs, List<? extends PropertyConstraint<?>> elementConstraints) Default constructor. |
|
ListValueConstraint(Class<?> elementType, Integer minOccurs, Integer maxOccurs, PropertyConstraint<?> elementConstraints) Convenience constructor using varargs for constraints. |
|
ListValueConstraint(Class<?> elementType, List<? extends PropertyConstraint<?>> elementConstraints) Convenience constructor if there are no constraints on the number of list elements. |
Method Summary | |
---|---|
String |
getDescription(Locale locale) Returns a localized description of the defined constraints. |
List<? extends PropertyConstraint<?>> |
getElementConstraints() Returns the constraints on the individual elements of the list. |
Class<?> |
getElementType() Returns the type of the list elements. |
Integer |
getMaxOccurs() Returns the maximum number of elements in the list. |
Integer |
getMinOccurs() Returns the minimum number of elements in the list. |
boolean |
isValid(List<?> value, Class<?> group) Checks if the given value is valid only if the constraint is in the given group. |
Methods inherited from class de.smartics.properties.spi.core.constraint.AbstractPropertyConstraint |
---|
getDescription, getViolationMessage, isMandatoryConstraint, isValid, toString, validate, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ListValueConstraint()
public ListValueConstraint(Class<?> elementType)
elementType
- the type of the list elements.
public ListValueConstraint(Class<?> elementType, List<? extends PropertyConstraint<?>> elementConstraints)
elementType
- the type of the list elements.
elementConstraints
- the constraints on the individual elements of the
public ListValueConstraint(Class<?> elementType, Integer minOccurs, Integer maxOccurs)
elementType
- the type of the list elements.
minOccurs
- the minimum number of elements in the list.
maxOccurs
- the maximum number of elements in the list.
public ListValueConstraint(Class<?> elementType, Integer minOccurs, Integer maxOccurs, PropertyConstraint<?> elementConstraints)
elementType
- the type of the list elements.
minOccurs
- the minimum number of elements in the list.
maxOccurs
- the maximum number of elements in the list.
elementConstraints
- the constraints on the individual elements of the list.
public ListValueConstraint(Class<?> elementType, Integer minOccurs, Integer maxOccurs, List<? extends PropertyConstraint<?>> elementConstraints)
elementType
- the type of the list elements.
minOccurs
- the minimum number of elements in the list.
maxOccurs
- the maximum number of elements in the list.
elementConstraints
- the constraints on the individual elements of the list.
Method Detail |
---|
public Class<?> getElementType()
public Integer getMinOccurs()
null
if there is no constraint on the minimum number of elements.
public Integer getMaxOccurs()
null
if there is no constraint on the maximum number of elements.
public List<? extends PropertyConstraint<?>> getElementConstraints()
null
.
public String getDescription(Locale locale)
PropertyConstraint
locale
- the locale to use to fetch a localized description.
public boolean isValid(List<?> value, Class<?> group)
PropertyConstraint
value
- the value to be checked.
group
- the validation only takes place if this constraint is in this group or the argument is
null
.
true
if the
value
is valid,
false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |