public class ValueFormatterMessageInterpolator extends Object implements MessageInterpolator
Formatter
. Check the Formatter
documentation for formatting syntax and options. If no
formatting string is specified String.valueOf(validatedValue)}
is called.
To interpolate the validated value add {validatedValue}
into the message. To specify a format
pattern use ${validatedValue:[format string]}
, e.g. ${validatedValue:%1$ty}
.MessageInterpolator.Context
Modifier and Type | Field and Description |
---|---|
static String |
VALIDATED_VALUE_FORMAT_SEPARATOR |
static String |
VALIDATED_VALUE_KEYWORD |
Constructor and Description |
---|
ValueFormatterMessageInterpolator() |
ValueFormatterMessageInterpolator(MessageInterpolator userMessageInterpolator) |
Modifier and Type | Method and Description |
---|---|
String |
interpolate(String message,
MessageInterpolator.Context context)
Interpolate the message template based on the contraint validation context.
|
String |
interpolate(String message,
MessageInterpolator.Context context,
Locale locale)
Interpolate the message template based on the contraint validation context.
|
public static final String VALIDATED_VALUE_KEYWORD
public static final String VALIDATED_VALUE_FORMAT_SEPARATOR
public ValueFormatterMessageInterpolator()
public ValueFormatterMessageInterpolator(MessageInterpolator userMessageInterpolator)
public String interpolate(String message, MessageInterpolator.Context context)
MessageInterpolator
MessageInterpolator
implementation. See the implementation documentation for more detail.interpolate
in interface MessageInterpolator
message
- The message to interpolate.context
- contextual information related to the interpolationpublic String interpolate(String message, MessageInterpolator.Context context, Locale locale)
MessageInterpolator
Locale
used is provided as a parameter.interpolate
in interface MessageInterpolator
message
- The message to interpolate.context
- contextual information related to the interpolationlocale
- the locale targeted for the messageCopyright © 2012 JBoss by Red Hat. All Rights Reserved.