com.levigo.util.swing.messaging
Class MessageFactoryHolder

java.lang.Object
  extended by com.levigo.util.swing.messaging.MessageFactoryHolder
All Implemented Interfaces:
MessageFactory

public class MessageFactoryHolder
extends Object
implements MessageFactory

A helper class for MessageManager.

This class integrates all registered MessageFactories and organize their handling (registering, priorising, etc.). It implements MessageFactory interface to be use as one by MessageManager.
This will normally not directly used by other classes than MessageManager.

Author:
Carolin Koehler

Method Summary
static void addMessageFactory(MessageFactory aFactory)
          Adds a given MessageFactory.
 boolean containsKey(String key)
          Returns whether given key has a value in one of the registered resources.
 Message createMessage(String messageKey)
          Create a Message specified by given key.
 Message createMessage(String messageKey, Object[] parameters, Throwable e)
          Create a Message specified by given key and additionally parameters.
 Message createMessage(String messageKey, Throwable e)
           
static MessageFactoryHolder getInstance()
          returns an instance of this class
 Collection getSuppressableMessages()
          Returns a Collection of Message identifiers of messages that are allowed to be suppressed by the user.
static void removeMessageFactory(MessageFactory aFactory)
          Removes a given Message Factory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static MessageFactoryHolder getInstance()
returns an instance of this class


addMessageFactory

public static void addMessageFactory(MessageFactory aFactory)
Adds a given MessageFactory.

Parameters:
aFactory -

removeMessageFactory

public static void removeMessageFactory(MessageFactory aFactory)
Removes a given Message Factory

Parameters:
aFactory - resource to be removed

containsKey

public boolean containsKey(String key)
Description copied from interface: MessageFactory
Returns whether given key has a value in one of the registered resources.

Specified by:
containsKey in interface MessageFactory
Parameters:
key - the key to look up in the resource bundle
Returns:
true if key has a valid value in one or more resources, false otherwise
See Also:
MessageFactory.containsKey(String)

createMessage

public Message createMessage(String messageKey)
Description copied from interface: MessageFactory
Create a Message specified by given key.

Specified by:
createMessage in interface MessageFactory
Returns:
Message
See Also:
MessageFactory.createMessage(String)

createMessage

public Message createMessage(String messageKey,
                             Throwable e)
See Also:
MessageFactory.createMessage(String)

createMessage

public Message createMessage(String messageKey,
                             Object[] parameters,
                             Throwable e)
Description copied from interface: MessageFactory
Create a Message specified by given key and additionally parameters.

Specified by:
createMessage in interface MessageFactory
Parameters:
messageKey - identifier key
parameters - replacing the placeholders {0}, {1}... in the body text.
e - an Exception belonging to the message
Returns:
Message
See Also:
MessageFactory.createMessage(String, Object[], Throwable)

getSuppressableMessages

public Collection getSuppressableMessages()
Returns a Collection of Message identifiers of messages that are allowed to be suppressed by the user.

Specified by:
getSuppressableMessages in interface MessageFactory


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.