public final class ValidationMessages extends MessageFactory
MessageFactory that provides the feedback messages
for the Validators that are provided out of the box.
By default, it uses a default bundle with the default messages
in english language, but it is also possible to provide a custom
bundle and LocaleDEFAULT_RELOAD_CONTROL, logger, reloadControl| Constructor and Description |
|---|
ValidationMessages()
Creates an instance which uses the default
english language bundle which ships with
the module
|
ValidationMessages(String bundlePath,
String locale)
Creates an instance which points to the given
bundlePath and locale |
| Modifier and Type | Method and Description |
|---|---|
Message |
arrayIsEmpty()
Generates a
Message for an array which was expected
to be not empty but was |
Message |
arrayIsNotEmpty()
Generates a
Message for an array
which was expected to be empty but wasn't |
Message |
collectionIsEmpty()
Generates a
Message for a value that was
expected to be not empty but was |
Message |
collectionIsNotEmpty()
Generates a
Message for a Collection
which was expected to be empty but wasn't |
Message |
failedBooleanValidation(boolean value,
boolean expected)
Generates a
Message for a boolean validation that failed |
protected ResourceBundle |
getBundle(String bundlePath) |
Message |
greaterThan(Object value,
Object boundary)
Returns a message for a
value that was
expected to be greater than boundary but isn't |
Message |
greaterThanMaxSize(Object value,
int maxSize,
int actualSize)
Generates a
Message for a value that was expected to have
a maximum size but didn't |
Message |
invalidEmail(String email)
Generates a
Message for an email validation
that failed |
Message |
invalidIp(String ip)
Generates a
Message for an ip address
validation that failed |
Message |
invalidNumberType(Object value,
String numberType)
Generates a
Message for a number type validation that failed |
Message |
invalidTime(String time,
String locale,
String pattern)
|
Message |
invalidUrl(String url)
Generates a
Message for a url that is not valid |
Message |
lowerThan(Object value,
Object boundary)
Returns a message for a
value that was
expected to be lower than boundary but isn't |
Message |
lowerThanMinSize(Object value,
int minSize,
int actualSize)
Generates a
Message for a value that was expected to have
a minimum size but didn't |
Message |
mapIsEmpty()
Generates a
Message for a map
that was expected to be not empty
but was |
Message |
mapIsNotEmpty()
|
Message |
regexDoesNotMatch(String value,
String regex)
|
Message |
stringIsBlank()
Generates a
Message for a string
that was expected to be not blank
but wasn't |
Message |
stringIsNotBlank()
Generates a
Message for a String which was expected
to be blank but wasn't |
Message |
valueIsBlankLiteral()
Generates a
Message for a value that was expected
to not be a BlankLiteral but was |
Message |
valueIsNull()
Generates a
Message for a value that is null
what it wasn't expected to be |
Message |
wasExpectingNull()
Generates a
Message for a value that
was expected to be null but wasn't |
createMessage, createMessage, createMessage, createMessage, createMessage, createStaticMessage, createStaticMessage, getBundlePath, getClassLoader, getReloadControl, getString, getString, getString, getStringpublic ValidationMessages()
protected ResourceBundle getBundle(String bundlePath)
getBundle in class MessageFactorypublic Message failedBooleanValidation(boolean value, boolean expected)
Message for a boolean validation that failedvalue - the value that was obtainedexpected - the value that was expectedMessagepublic Message invalidNumberType(Object value, String numberType)
Message for a number type validation that failedvalue - the value that was testednumberType - the type that the tested value was expected to haveMessagepublic Message lowerThan(Object value, Object boundary)
value that was
expected to be lower than boundary but isn'tvalue - the valueboundary - the boundaryMessagepublic Message greaterThan(Object value, Object boundary)
value that was
expected to be greater than boundary but isn'tvalue - the valueboundary - the boundaryMessagepublic Message invalidEmail(String email)
Message for an email validation
that failedemail - the validated email addressMessagepublic Message invalidIp(String ip)
Message for an ip address
validation that failedip - the validated ip addressMessagepublic Message lowerThanMinSize(Object value, int minSize, int actualSize)
Message for a value that was expected to have
a minimum size but didn'tvalue - the tested valueminSize - the minimum boundary used in the validationactualSize - the actual value sizeMessagepublic Message greaterThanMaxSize(Object value, int maxSize, int actualSize)
Message for a value that was expected to have
a maximum size but didn'tvalue - the tested valuemaxSize - the maximum boundary used in the validationactualSize - the actual value sizeMessagepublic Message valueIsNull()
Message for a value that is null
what it wasn't expected to beMessagepublic Message collectionIsEmpty()
Message for a value that was
expected to be not empty but wasMessagepublic Message stringIsBlank()
Message for a string
that was expected to be not blank
but wasn'tMessagepublic Message mapIsEmpty()
Message for a map
that was expected to be not empty
but wasMessagepublic Message valueIsBlankLiteral()
Message for a value that was expected
to not be a BlankLiteral but wasMessagepublic Message wasExpectingNull()
Message for a value that
was expected to be null but wasn'tMessagepublic Message invalidUrl(String url)
Message for a url that is not validurl - the tested urlMessagepublic Message regexDoesNotMatch(String value, String regex)
value - the tested valueregex - the regex that the value was tested againstMessagepublic Message arrayIsEmpty()
Message for an array which was expected
to be not empty but wasMessagepublic Message stringIsNotBlank()
Message for a String which was expected
to be blank but wasn'tMessagepublic Message collectionIsNotEmpty()
Message for a Collection
which was expected to be empty but wasn'tMessageCopyright © 2003–2023 MuleSoft, Inc.. All rights reserved.