public class ResourceBundleMessageInterpolator extends java.lang.Object implements MessageInterpolator
By default this looks for a resource bundle file called "ValidationMessages.properties" on the class path but you can can
override getResourceBundle(java.util.Locale) to provide your own resource bundle
If it finds no resources then it will use the message template as is and do parameter and expression replacement on it
This class is heavily inspired by the Hibernate Validator projects ResourceBundleMessageInterpolator implementation and in fact uses that in its implementation and hence the standard facilities such as well known "parameters" like "validatedValue" and "format" are available.
See the Hibernate Validation documentation for more details
| Constructor and Description |
|---|
ResourceBundleMessageInterpolator() |
| Modifier and Type | Method and Description |
|---|---|
protected graphql.ErrorClassification |
buildErrorClassification(java.lang.String messageTemplate,
java.util.Map<java.lang.String,java.lang.Object> messageParams,
ValidationEnvironment validationEnvironment)
Override this method to build your own ErrorClassification
|
protected java.util.ResourceBundle |
getResourceBundle(java.util.Locale locale)
You can override this to provide your own resource bundles for a given locale
|
graphql.GraphQLError |
interpolate(java.lang.String messageTemplate,
java.util.Map<java.lang.String,java.lang.Object> messageParams,
ValidationEnvironment validationEnvironment)
Called to interpolate a message template and arguments into a
GraphQLError |
protected graphql.ErrorClassification buildErrorClassification(java.lang.String messageTemplate,
java.util.Map<java.lang.String,java.lang.Object> messageParams,
ValidationEnvironment validationEnvironment)
messageTemplate - the message templatemessageParams - the parametersvalidationEnvironment - the rule environmentprotected java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
locale - the locale in questionpublic graphql.GraphQLError interpolate(java.lang.String messageTemplate,
java.util.Map<java.lang.String,java.lang.Object> messageParams,
ValidationEnvironment validationEnvironment)
MessageInterpolatorGraphQLErrorinterpolate in interface MessageInterpolatormessageTemplate - the message templatemessageParams - the parameters to this errorvalidationEnvironment - the validation environmentGraphQLError