public final class NullifyConstraint extends CorrectConstraint<String>
CorrectConstraint
implementation that
replaces an empty string with null
.Nullify
,
ConstraintFactory.nullify()
Modifier and Type | Field and Description |
---|---|
static NullifyConstraint |
DEFAULT
NullifyConstraint single instance. |
Modifier and Type | Method and Description |
---|---|
Class<?> |
getType()
Returns
java.lang.String type. |
<T> String |
validate(String value,
ValidationContext<T> context)
Returns
null if the specified string is empty; returns
string as is otherwise. |
getMessageTemplate
appendMessageArguments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendMessageArguments
public static final NullifyConstraint DEFAULT
NullifyConstraint
single instance.public Class<?> getType()
java.lang.String
type.java.lang.String
type.public <T> String validate(String value, ValidationContext<T> context)
null
if the specified string is empty; returns
string as is otherwise.T
- The type of validated entity.value
- Source string.context
- Validation context.null
if the specified string is empty; string as is
otherwise.Copyright © 2011–2020 FoxLabs. All rights reserved.