Anyframe Web

anyframe.web.struts.util
Class DefaultPropertyMessageResources

java.lang.Object
  extended by org.apache.struts.util.MessageResources
      extended by org.apache.struts.util.PropertyMessageResources
          extended by anyframe.web.struts.util.DefaultPropertyMessageResources
All Implemented Interfaces:
java.io.Serializable

public class DefaultPropertyMessageResources
extends org.apache.struts.util.PropertyMessageResources

Concrete subclass of MessageResources that reads message keys and corresponding strings from named property resources in the same manner that java.util.PropertyResourceBundle does. The base property defines the base property resource name, and must be specified.

IMPLEMENTATION NOTE - This class trades memory for speed by caching all messages located via generalizing the Locale under the original locale as well. This results in specific messages being stored in the message cache more than once, but improves response time on subsequent requests for the same locale + key combination.

Author:
Byunghun Woo
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.struts.util.PropertyMessageResources
locales, log, messages
 
Fields inherited from class org.apache.struts.util.MessageResources
config, defaultFactory, defaultLocale, factory, formats, returnNull
 
Constructor Summary
DefaultPropertyMessageResources(org.apache.struts.util.MessageResourcesFactory factory, java.lang.String config, boolean returnNull)
          Construct a new PropertyMessageResources according to the specified parameters.
 
Method Summary
 java.lang.String getCharset()
           
 java.lang.String getMessage(java.util.Locale locale, java.lang.String key)
          Returns a text message for the specified key, for the default Locale.
 void setCharset(java.lang.String string)
           
 
Methods inherited from class org.apache.struts.util.PropertyMessageResources
loadLocale, setMode
 
Methods inherited from class org.apache.struts.util.MessageResources
escape, getConfig, getFactory, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessageResources, getReturnNull, isEscape, isPresent, isPresent, localeKey, log, log, messageKey, messageKey, setEscape, setReturnNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPropertyMessageResources

public DefaultPropertyMessageResources(org.apache.struts.util.MessageResourcesFactory factory,
                                       java.lang.String config,
                                       boolean returnNull)
Construct a new PropertyMessageResources according to the specified parameters.

Parameters:
factory - The MessageResourcesFactory that created us
config - The configuration parameter for this MessageResources
returnNull - The returnNull property we should initialize with
Method Detail

getMessage

public java.lang.String getMessage(java.util.Locale locale,
                                   java.lang.String key)
Returns a text message for the specified key, for the default Locale. A null string result will be returned by this method if no relevant message resource is found for this key or Locale, if the returnNull property is set. Otherwise, an appropriate error message will be returned.

This method must be implemented by a concrete subclass.

Overrides:
getMessage in class org.apache.struts.util.PropertyMessageResources
Parameters:
locale - The requested message Locale, or null for the system default Locale
key - The message key to look up
Returns:
text message for the specified key and locale

getCharset

public java.lang.String getCharset()
Returns:
String Charset

setCharset

public void setCharset(java.lang.String string)
Parameters:
string -

Anyframe Web

Copyright © 2008-2009 Samsung SDS. All Rights Reserved.