BeanIO 2.0.4

org.beanio.internal.parser.message
Class ResourceBundleMessageFactory

java.lang.Object
  extended by org.beanio.internal.parser.message.ResourceBundleMessageFactory
All Implemented Interfaces:
MessageFactory

public class ResourceBundleMessageFactory
extends Object
implements MessageFactory

Since:
2.0
Author:
Kevin Seim

Constructor Summary
ResourceBundleMessageFactory()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBundleMessageFactory

public ResourceBundleMessageFactory()
Method Detail

getRecordLabel

public String getRecordLabel(String recordName)
Description copied from interface: MessageFactory
Returns the localized label for a record.

Specified by:
getRecordLabel in interface MessageFactory
Parameters:
recordName - the name of the record
Returns:
the record label, or null if no label was found

getFieldLabel

public String getFieldLabel(String recordName,
                            String fieldName)
Description copied from interface: MessageFactory
Returns the localized label for a field.

Specified by:
getFieldLabel in interface MessageFactory
Parameters:
recordName - the name of the record the field belongs to
fieldName - the name of the field
Returns:
the field label, or null if no label was found

getLabel

protected String getLabel(String key)
Returns a label from the configured resource bundle.

Parameters:
key - the resource bundle key
Returns:
the label, or null if not found

getFieldErrorMessage

public String getFieldErrorMessage(String recordName,
                                   String fieldName,
                                   String rule)
Description copied from interface: MessageFactory
Returns a field level error message.

Specified by:
getFieldErrorMessage in interface MessageFactory
Parameters:
recordName - the name of the record
fieldName - the name of the field
rule - the name of the validation rule
Returns:
the error message, or null if no message was configured

getRecordErrorMessage

public String getRecordErrorMessage(String recordName,
                                    String rule)
Description copied from interface: MessageFactory
Returns a record level error message.

Specified by:
getRecordErrorMessage in interface MessageFactory
Parameters:
recordName - the name of the record
rule - the name of the validation rule
Returns:
the error message, or null if no message was configured

setResourceBundle

public void setResourceBundle(ResourceBundle resourceBundle)
Sets the primary resource bundle to check for messages.

Parameters:
resourceBundle - the resource bundle

setDefaultResourceBundle

public void setDefaultResourceBundle(ResourceBundle defaultResourceBundle)
Sets the default resource bundle to check of messages not found in the primary resource bundle.

Parameters:
defaultResourceBundle - the default resource bundle

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim