public class ResourceBundleMessageFactory extends Object implements MessageFactory
| Constructor and Description |
|---|
ResourceBundleMessageFactory() |
| Modifier and Type | Method and Description |
|---|---|
String |
getFieldErrorMessage(String recordName,
String fieldName,
String rule)
Returns a field level error message.
|
String |
getFieldLabel(String recordName,
String fieldName)
Returns the localized label for a field.
|
protected String |
getLabel(String key)
Returns a label from the configured resource bundle.
|
String |
getRecordErrorMessage(String recordName,
String rule)
Returns a record level error message.
|
String |
getRecordLabel(String recordName)
Returns the localized label for a record.
|
void |
setDefaultResourceBundle(ResourceBundle defaultResourceBundle)
Sets the default resource bundle to check of messages not found in the
primary resource bundle.
|
void |
setResourceBundle(ResourceBundle resourceBundle)
Sets the primary resource bundle to check for messages.
|
public String getRecordLabel(String recordName)
MessageFactorygetRecordLabel in interface MessageFactoryrecordName - the name of the recordpublic String getFieldLabel(String recordName, String fieldName)
MessageFactorygetFieldLabel in interface MessageFactoryrecordName - the name of the record the field belongs tofieldName - the name of the fieldprotected String getLabel(String key)
key - the resource bundle keypublic String getFieldErrorMessage(String recordName, String fieldName, String rule)
MessageFactorygetFieldErrorMessage in interface MessageFactoryrecordName - the name of the recordfieldName - the name of the fieldrule - the name of the validation rulepublic String getRecordErrorMessage(String recordName, String rule)
MessageFactorygetRecordErrorMessage in interface MessageFactoryrecordName - the name of the recordrule - the name of the validation rulepublic void setResourceBundle(ResourceBundle resourceBundle)
resourceBundle - the resource bundlepublic void setDefaultResourceBundle(ResourceBundle defaultResourceBundle)
defaultResourceBundle - the default resource bundle