de.smartics.exceptions.i18n.message
Class LocalizedInfo

Package class diagram package LocalizedInfo
java.lang.Object
  extended by de.smartics.exceptions.i18n.message.LocalizedInfo
All Implemented Interfaces:
Serializable

public class LocalizedInfo
     
     
extends Object
implements Serializable

Controls the localized information for a throwable.

Author:
Robert Reiner
See Also:
Serialized Form

Field Summary
static String BUNDLE_NAME_SUFFIX
          The suffix for the auto generated bundle name.
protected  String bundleBaseName
          The fully qualified base name of the bundle to use.
protected  String resourceKey
          The localization key to fetch messages from message bundles.
 
Constructor Summary
LocalizedInfo(Code code, String bundleBaseName, String resourceKey)
          Default constructor.
 
Method Summary
 String getBundleBaseName()
          Returns the fully qualified base name of the bundle to use.
 String getLocalizedMessage(Throwable throwable, Locale locale, ClassLoader loader)
          Returns the localized message for the given locale.
 String getLocalizedMessage(Throwable throwable, String keyPrefix, Locale locale, MessageType messageType, ClassLoader loader)
          Returns the localized message for the given locale.
 String getLocalizedSingleLineMessage(Throwable throwable, Locale locale, ClassLoader loader, boolean standard)
          Returns the localized message for the given locale.
 String getLocalizedTextMessage(Throwable throwable, Locale locale, ClassLoader loader)
          Returns the structured and localized message for the given locale, returning each part of information that is provided.
 String getResourceKey()
          Returns the localization key to fetch messages from message bundles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE_NAME_SUFFIX

public static final String BUNDLE_NAME_SUFFIX
The suffix for the auto generated bundle name.

The value of this constant is "Bundle".

Constant Field Value:
"Bundle"

resourceKey

protected final String resourceKey
The localization key to fetch messages from message bundles. If this value is not set, the String representation of the provided code instance is used.


bundleBaseName

protected final String bundleBaseName
The fully qualified base name of the bundle to use.

This bundle base name must never be null.

Constructor Detail

LocalizedInfo

public LocalizedInfo(Code code,
                     String bundleBaseName,
                     String resourceKey)
Default constructor.

Parameters:
code - the error or exception code of the exception.
bundleBaseName - the fully qualified name of the bundle to use.
resourceKey - the localization key to fetch messages from message bundles.
Method Detail

getResourceKey

public String getResourceKey()
Returns the localization key to fetch messages from message bundles. If this value is not set, the String representation of the code instance is used.

Returns:
the localization key to fetch messages from message bundles.

getBundleBaseName

public String getBundleBaseName()
Returns the fully qualified base name of the bundle to use.

Returns:
the fully qualified base name of the bundle to use.

getLocalizedMessage

public String getLocalizedMessage(Throwable throwable,
                                  Locale locale,
                                  ClassLoader loader)
Returns the localized message for the given locale.

Parameters:
throwable - the throwable to construct the localized message.
locale - the locale for which the message is requested.
loader - the loader to read the message bundle.
Returns:
returns the localized message of this exception.

getLocalizedSingleLineMessage

public String getLocalizedSingleLineMessage(Throwable throwable,
                                            Locale locale,
                                            ClassLoader loader,
                                            boolean standard)
Returns the localized message for the given locale.

Parameters:
throwable - the throwable to construct the localized message.
locale - the locale for which the message is requested.
loader - the loader to read the message bundle.
Returns:
returns the localized message of this exception.

getLocalizedTextMessage

public String getLocalizedTextMessage(Throwable throwable,
                                      Locale locale,
                                      ClassLoader loader)
Returns the structured and localized message for the given locale, returning each part of information that is provided.

Parameters:
throwable - the throwable to construct the localized message.
locale - the locale for which the message is requested.
loader - the loader to read the message bundle.
Returns:
returns the localized message of this exception.

getLocalizedMessage

public String getLocalizedMessage(Throwable throwable,
                                  String keyPrefix,
                                  Locale locale,
                                  MessageType messageType,
                                  ClassLoader loader)
Returns the localized message for the given locale.

Parameters:
throwable - the throwable to construct the localized message.
keyPrefix - the prefix of the key to load from the bundle.
locale - the locale for which the message is requested.
messageType - the type of message to localize.
loader - the loader to read the message bundle.
Returns:
returns the localized message of this exception.


Copyright © 2007-null Kronseder & Reiner GmbH - smartics. All Rights Reserved.