public class ElementCountConstraint extends Constraint
mErrorMessage
Constructor and Description |
---|
ElementCountConstraint(String pErrorMessage,
Integer pMinCount,
Integer pMaxCount)
Create a new ElementCountConstraint with the given minimum and maximum bounds.
|
ElementCountConstraint(String pErrorMessage,
Integer pMinCount,
Integer pMaxCount,
Integer pDefaultCount)
Create a new ElementCountConstraint with the given minimum and
maximum bounds as well as a default count.
|
Modifier and Type | Method and Description |
---|---|
String |
describeError(Object pValue) |
Integer |
getDefaultCount() |
Integer |
getMaxCount() |
Integer |
getMinCount() |
boolean |
isValid(Object pValue)
Returns true if the size/length of the given collection or array is within the specified bounds.
|
equals, hashCode, toString
public ElementCountConstraint(String pErrorMessage, Integer pMinCount, Integer pMaxCount)
pMinCount
- the minimum size or length for this constraint.pMaxCount
- the maximum size or length for this constraint.public ElementCountConstraint(String pErrorMessage, Integer pMinCount, Integer pMaxCount, Integer pDefaultCount)
pMinCount
- the minimum size or length for this constraint.pMaxCount
- the maximum size or length for this constraint.pDefaultCount
- the default size or length for this constraint.public boolean isValid(Object pValue)
null
, and throw an IllegalArgumentException if the given value isn't a
collection or an array.isValid
in class Constraint
pValue
- a Collection or array to validate the size/length of.public String describeError(Object pValue)
describeError
in class Constraint
public Integer getMinCount()
public Integer getMaxCount()
public Integer getDefaultCount()
© 1998- 2021 Escenic AS