com.ideo.sweetdevria.util
Class MessageResources

java.lang.Object
  extended by com.ideo.sweetdevria.util.MessageResources
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
PropertyMessageResources

public abstract class MessageResources
extends java.lang.Object
implements java.io.Serializable

Messages resources abstract class. Initially from org.apache.struts.util.MessageResourcesFactory.

See Also:
Serialized Form

Field Summary
protected static MessageResourcesFactory defaultFactory
          Default factory.
protected  MessageResourcesFactory factory
          Factory.
protected static org.apache.commons.logging.Log LOG
          Logger.
protected  java.lang.String propertiesFileName
          Properties file name.
protected  boolean returnNull
          Return null ?
 
Constructor Summary
MessageResources(MessageResourcesFactory factory, java.lang.String propertiesFileName)
          Constructor.
MessageResources(MessageResourcesFactory factory, java.lang.String propertiesFileName, boolean returnNull)
          Constructor.
 
Method Summary
 java.lang.String getConfig()
          Get the config.
 MessageResourcesFactory getFactory()
          Get the factory.
abstract  java.lang.String getMessage(java.util.Locale locale, java.lang.String messageKey)
          Get message from the specific locale.
abstract  java.lang.String getMessage(java.lang.String messageKey)
          Get message from the default locale (English).
abstract  java.lang.String getMessage(java.lang.String key, java.lang.Object object)
          Get message by using object in argument.
static MessageResources getMessageResources(java.lang.String propertiesFileName)
          Get messages resources.
 boolean getReturnNull()
          Get the returnNull.
 void setReturnNull(boolean returnNull)
          Set the returnNull.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Logger.


propertiesFileName

protected java.lang.String propertiesFileName
Properties file name.


factory

protected MessageResourcesFactory factory
Factory.


returnNull

protected boolean returnNull
Return null ? (not used here)


defaultFactory

protected static MessageResourcesFactory defaultFactory
Default factory.

Constructor Detail

MessageResources

public MessageResources(MessageResourcesFactory factory,
                        java.lang.String propertiesFileName)
Constructor.

Parameters:
factory - Factory used.
propertiesFileName - Properties file name.

MessageResources

public MessageResources(MessageResourcesFactory factory,
                        java.lang.String propertiesFileName,
                        boolean returnNull)
Constructor.

Parameters:
factory - Factory used.
propertiesFileName - Properties file name.
returnNull - Return null ? (not used here)
Method Detail

getMessage

public abstract java.lang.String getMessage(java.util.Locale locale,
                                            java.lang.String messageKey)
Get message from the specific locale.

Parameters:
locale - locale in wich get message.
messageKey - message key.
Returns:
message value in specified locale or in default locale (English) if not available.

getMessage

public abstract java.lang.String getMessage(java.lang.String messageKey)
Get message from the default locale (English).

Parameters:
messageKey - message key.
Returns:
message value in default locale (English).

getMessage

public abstract java.lang.String getMessage(java.lang.String key,
                                            java.lang.Object object)
Get message by using object in argument.

Parameters:
key - message key.
object - Object used to get the locale (i.e. PageContext from where extract the locale).
Returns:
messave value.

getConfig

public java.lang.String getConfig()
Get the config.

Returns:
Returns the config.

getFactory

public MessageResourcesFactory getFactory()
Get the factory.

Returns:
Returns the factory.

getReturnNull

public boolean getReturnNull()
Get the returnNull.

Returns:
Returns the returnNull.

setReturnNull

public void setReturnNull(boolean returnNull)
Set the returnNull.

Parameters:
returnNull - The returnNull to set.

getMessageResources

public static MessageResources getMessageResources(java.lang.String propertiesFileName)
Get messages resources.

Parameters:
propertiesFileName - Properties file name.
Returns:
a message resources object corresponding to a properties file


Copyright © 2010 Ideo Technologies. All Rights Reserved.