de.smartics.exceptions.i18n
Class AbstractMessageBean

Package class diagram package AbstractMessageBean
java.lang.Object
  extended by de.smartics.exceptions.i18n.AbstractMessageBean
All Implemented Interfaces:
MessageBean, Serializable

public abstract class AbstractMessageBean
     
     
extends Object
implements MessageBean

The message information for a incidence.

See Also:
Serialized Form

Field Summary
protected  Code code
          The error or exception code of the exception.
protected  LocalizedInfo localizedInfo
          The localized information controls the localization information.
 
Constructor Summary
protected AbstractMessageBean(Code code)
          Convenience constructor to use if the defaults for bundleBaseName and resource key are used.
protected AbstractMessageBean(Code code, String bundleBaseName)
          Constructor to control the bundle name.
protected AbstractMessageBean(Code code, String bundleBaseName, String resourceKey)
          Default constructor to control the bundle name and resource key.
protected AbstractMessageBean(Code code, Throwable cause)
          Convenience constructor to use if the defaults for bundleBaseName and resource key are used, with cause.
protected AbstractMessageBean(Code code, Throwable cause, String bundleBaseName)
          Constructor to control the bundle name, with cause.
protected AbstractMessageBean(Code code, Throwable cause, String bundleBaseName, String resourceKey)
          Default constructor to control the bundle name and resource key.
 
Method Summary
 Throwable getCause()
          Returns the cause to the exception.
 CauseTrailMessages getCauseTrail()
          Returns the cause trail of messages.
 CauseTrailMessages getCauseTrail(Locale locale)
          Returns the cause trail of messages.
 Code getCode()
          Returns the error or exception code of the exception.
 LocalizedInfo getLocalizedInfo()
          Returns the localized information controls the localization information.
 String getLocalizedMessage()
          Returns the localized message for the given locale.
 String getLocalizedMessage(Locale locale)
          Returns the localized message for the given locale.
 String getLocalizedMessage(Locale locale, ClassLoader loader)
          Returns the localized message for the given locale.
 String getLocalizedMessage(String keyPrefix, Locale locale, MessageType messageType, ClassLoader loader)
          Returns the localized message for the given locale.
 String getLocalizedTextMessage()
          Returns the localized message for the given locale as formatted multi-line text.
 String getLocalizedTextMessage(Locale locale)
          Returns the localized message for the given locale as formatted multi-line text.
 String getLocalizedTextMessage(Locale locale, ClassLoader loader)
          Returns the localized message for the given locale as formatted multi-line text.
 String getMessage()
           Returns the localized message for the default locale.
 String getMessage(Locale locale, MessageType messageType)
          Returns the message for the given type.
 String getMessage(MessageType messageType)
          Calls AbstractLocalizedException.getMessage(java.util.Locale, de.smartics.exceptions.i18n.message.MessageType) with argument list (Locale.getDefault(), <messageType>).
 String getMessages()
          Creates the messages as a string, based on the default locale.
 Messages getMessages(Locale locale)
          Creates the messages with the given locale.
 String toString()
          Returns the string representation of the exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

code

protected final Code code
The error or exception code of the exception.


localizedInfo

protected final LocalizedInfo localizedInfo
The localized information controls the localization information.

Constructor Detail

AbstractMessageBean

protected AbstractMessageBean(Code code)
Convenience constructor to use if the defaults for bundleBaseName and resource key are used.

Parameters:
code - the error or exception code of the exception.

AbstractMessageBean

protected AbstractMessageBean(Code code,
                              Throwable cause)
Convenience constructor to use if the defaults for bundleBaseName and resource key are used, with cause.

Parameters:
code - the error or exception code of the exception.
cause - the cause to the problem.

AbstractMessageBean

protected AbstractMessageBean(Code code,
                              String bundleBaseName)
Constructor to control the bundle name.

Parameters:
code - the error or exception code of the exception.
bundleBaseName - the fully qualified name of the bundle to use.

AbstractMessageBean

protected AbstractMessageBean(Code code,
                              Throwable cause,
                              String bundleBaseName)
Constructor to control the bundle name, with cause.

Parameters:
code - the error or exception code of the exception.
cause - the cause to the problem.
bundleBaseName - the fully qualified name of the bundle to use.

AbstractMessageBean

protected AbstractMessageBean(Code code,
                              String bundleBaseName,
                              String resourceKey)
Default constructor to control the bundle name and resource key.

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.

AbstractMessageBean

protected AbstractMessageBean(Code code,
                              Throwable cause,
                              String bundleBaseName,
                              String resourceKey)
Default constructor to control the bundle name and resource key.

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

getCode

public final Code getCode()
Returns the error or exception code of the exception.

Specified by:
getCode in interface MessageBean
Returns:
the error or exception code of the exception.

getLocalizedInfo

public final LocalizedInfo getLocalizedInfo()
Returns the localized information controls the localization information.

Specified by:
getLocalizedInfo in interface MessageBean
Returns:
the localized information controls the localization information.

getMessage

public final String getMessage()

Returns the localized message for the default locale.


getMessage

public final String getMessage(MessageType messageType)
Calls AbstractLocalizedException.getMessage(java.util.Locale, de.smartics.exceptions.i18n.message.MessageType) with argument list ( Locale.getDefault(), <messageType>).

Parameters:
messageType - the type of message to fetch.
Returns:
the message for the given type.
See Also:
AbstractLocalizedException.getMessage(java.util.Locale, de.smartics.exceptions.i18n.message.MessageType)

getMessage

public final String getMessage(Locale locale,
                               MessageType messageType)
Description copied from interface: MessageBean
Returns the message for the given type.

Specified by:
getMessage in interface MessageBean
Parameters:
locale - the locale to use.
messageType - the type of message to retrieve.
Returns:
the message or null if there is no message for the given type.

getLocalizedMessage

public final String getLocalizedMessage()
Returns the localized message for the given locale.

Calls getLocalizedMessage(java.util.Locale) with argument list ( Locale.getDefault()).

Returns:
returns the localized message of this exception.
See Also:
AbstractLocalizedException.getLocalizedMessage(java.util.Locale)

getLocalizedMessage

public final String getLocalizedMessage(Locale locale)
Returns the localized message for the given locale.

Calls getLocalizedMessage(java.util.Locale,ClassLoader) with argument list (<locale>, null).

Parameters:
locale - locale the locale for which the message is requested.
Returns:
returns the localized message of this exception.
See Also:
getLocalizedMessage(java.util.Locale, ClassLoader)

getLocalizedMessage

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

Calls getLocalizedMessage(String,java.util.Locale,de.smartics.exceptions.i18n.message.MessageType,java.lang.ClassLoader) with argument list (null, <locale>, MessageType.SUMMARY, <loader>).

Parameters:
locale - locale the locale for which the message is requested.
loader - loader the loader to read the message bundle.
Returns:
returns the localized message of this exception.
See Also:
getLocalizedMessage(String,java.util.Locale,de.smartics.exceptions.i18n.message.MessageType,java.lang.ClassLoader)

getLocalizedMessage

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

Parameters:
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.

getLocalizedTextMessage

public final String getLocalizedTextMessage()
Returns the localized message for the given locale as formatted multi-line text.

Returns:
returns the localized message of this exception.
See Also:
AbstractLocalizedException.getLocalizedMessage(java.util.Locale)

getLocalizedTextMessage

public final String getLocalizedTextMessage(Locale locale)
Returns the localized message for the given locale as formatted multi-line text.

Parameters:
locale - locale the locale for which the message is requested.
Returns:
returns the localized message of this exception.
See Also:
getLocalizedMessage(java.util.Locale, ClassLoader)

getLocalizedTextMessage

public final String getLocalizedTextMessage(Locale locale,
                                            ClassLoader loader)
Returns the localized message for the given locale as formatted multi-line text.

Parameters:
locale - locale the locale for which the message is requested.
loader - loader the loader to read the message bundle.
Returns:
returns the localized message of this exception.
See Also:
getLocalizedMessage(String,java.util.Locale,de.smartics.exceptions.i18n.message.MessageType,java.lang.ClassLoader)

getMessages

public final String getMessages()
Creates the messages as a string, based on the default locale.

Returns:
the messages as a string.

getMessages

public final Messages getMessages(Locale locale)
Creates the messages with the given locale.

Specified by:
getMessages in interface MessageBean
Parameters:
locale - the locale to use.
Returns:
the created messages instance.

getCauseTrail

public final CauseTrailMessages getCauseTrail()
Description copied from interface: MessageBean
Returns the cause trail of messages. These are all messages of the cause to the root cause.

Specified by:
getCauseTrail in interface MessageBean
Returns:
the cause trail of messages.

getCauseTrail

public final CauseTrailMessages getCauseTrail(Locale locale)
Description copied from interface: MessageBean
Returns the cause trail of messages. These are all messages of the cause to the root cause.

Specified by:
getCauseTrail in interface MessageBean
Parameters:
locale - the locale to use.
Returns:
the cause trail of messages.

getCause

public Throwable getCause()
Returns the cause to the exception. May be null.

May be override to return a covariant type.

Specified by:
getCause in interface MessageBean
Returns:
the cause to the exception. May be null.

toString

public String toString()
Returns the string representation of the exception.

May be overridden by subclasses in an application (not a library) to change the string representation. Usually an implementation of I18nCodeMessageFormatter should be set to the de.smartics.exceptions.ExceptionContext.

Overrides:
toString in class Object
Returns:
the string representation of the object.


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