public final class InstanceOfConstraint extends CheckConstraint<Object>
CheckConstraint
implementation that checks
whether a value is instance of one of allowed types.InstanceOf
,
ConstraintFactory.instanceOf(Class...)
Modifier and Type | Method and Description |
---|---|
boolean |
appendMessageArguments(ValidationContext<?> context,
Map<String,Object> arguments)
Appends
types argument that contains array of allowed types. |
protected <T> boolean |
check(Object value,
ValidationContext<T> context)
Checks whether the specified value is instance of one of allowed types.
|
Class<?> |
getType()
Returns
java.lang.Object type. |
validate
getMessageTemplate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageTemplate
public Class<?> getType()
java.lang.Object
type.java.lang.Object
type.public boolean appendMessageArguments(ValidationContext<?> context, Map<String,Object> arguments)
types
argument that contains array of allowed types.appendMessageArguments
in interface Constraint<Object>
appendMessageArguments
in interface Validation<Object>
appendMessageArguments
in class AbstractValidation<Object>
context
- Validation context.arguments
- Arguments to be substituted into the error message
template.true
.protected <T> boolean check(Object value, ValidationContext<T> context)
check
in class CheckConstraint<Object>
T
- The type of validated entity.value
- Value to be checked.context
- Validation context.true
if the specified value is instance of one of
allowed types; false
otherwise.Copyright © 2011–2020 FoxLabs. All rights reserved.