public class IllegalCharsetConstraint extends CheckConstraint<String>
CheckConstraint
implementation that checks
whether a string not contains disallowed characters.IllegalCharset
,
ConstraintFactory.illegalCharset(String)
,
ConstraintFactory.illegalCharset(UnicodeSet)
Modifier and Type | Field and Description |
---|---|
protected org.foxlabs.util.UnicodeSet |
charset
Disallowed character set.
|
Modifier | Constructor and Description |
---|---|
protected |
IllegalCharsetConstraint(org.foxlabs.util.UnicodeSet charset)
Constructs a new
IllegalCharsetConstraint with the
specified disallowed character set. |
Modifier and Type | Method and Description |
---|---|
boolean |
appendMessageArguments(ValidationContext<?> context,
Map<String,Object> arguments)
Appends
charset argument that contains disallowed character
set. |
protected <T> boolean |
check(String value,
ValidationContext<T> context)
Checks whether the specified string not contains disallowed characters.
|
org.foxlabs.util.UnicodeSet |
getCharset()
Returns disallowed character set.
|
Class<?> |
getType()
Returns
java.lang.String type. |
validate
getMessageTemplate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageTemplate
protected IllegalCharsetConstraint(org.foxlabs.util.UnicodeSet charset)
IllegalCharsetConstraint
with the
specified disallowed character set.charset
- Disallowed character set.IllegalArgumentException
- if the specified character set is
null
or empty.public final org.foxlabs.util.UnicodeSet getCharset()
public final Class<?> getType()
java.lang.String
type.java.lang.String
type.public boolean appendMessageArguments(ValidationContext<?> context, Map<String,Object> arguments)
charset
argument that contains disallowed character
set.appendMessageArguments
in interface Constraint<String>
appendMessageArguments
in interface Validation<String>
appendMessageArguments
in class AbstractValidation<String>
context
- Validation context.arguments
- Arguments to be substituted into the error message
template.true
.protected <T> boolean check(String value, ValidationContext<T> context)
check
in class CheckConstraint<String>
T
- The type of validated entity.value
- String to be checked.context
- Validation context.true
if the specified string not contains
disallowed characters; false
otherwise.Copyright © 2011–2020 FoxLabs. All rights reserved.