V
- The type of value to be validatedpublic final class DefaultValueConstraint<V> extends CorrectConstraint<V>
CorrectConstraint
implementation that
replaces a null
value with default value.DefaultValue
,
ConstraintFactory.defaultValue(Object)
Modifier and Type | Method and Description |
---|---|
V |
getDefaultValue()
Returns default value.
|
Class<?> |
getType()
Returns the type of value to be validated.
|
<T> V |
validate(V value,
ValidationContext<T> context)
Returns default value if the specified value is
null ;
returns value as is otherwise. |
getMessageTemplate
appendMessageArguments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendMessageArguments
public Class<?> getType()
public V getDefaultValue()
public <T> V validate(V value, ValidationContext<T> context)
null
;
returns value as is otherwise.T
- The type of validated entity.value
- Value to be checked for null
.context
- Validation context.null
;
value as is otherwise.Copyright © 2011–2020 FoxLabs. All rights reserved.