public final class MaxLengthConstraint extends CorrectConstraint<String>
CorrectConstraint
implementation that
allows to cut length of a string.MaxLength
,
ConstraintFactory.maxLength(int)
Modifier and Type | Method and Description |
---|---|
int |
getLimit()
Returns maximum string length.
|
Class<?> |
getType()
Returns
java.lang.String type. |
<T> String |
validate(String value,
ValidationContext<T> context)
Returns substring of maximum length for the specified string or string
as is if its length is not greater than maximum length.
|
getMessageTemplate
appendMessageArguments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendMessageArguments
public int getLimit()
public Class<?> getType()
java.lang.String
type.java.lang.String
type.public <T> String validate(String value, ValidationContext<T> context)
T
- The type of validated entity.value
- Source string.context
- Validation context.Copyright © 2011–2020 FoxLabs. All rights reserved.