com.levigo.util.swing.messaging
Class DefaultMessageResource

java.lang.Object
  extended by com.levigo.util.swing.messaging.DefaultMessageResource
All Implemented Interfaces:
MessageResource

public class DefaultMessageResource
extends Object
implements MessageResource

BasicMessageResource combines the functionality of a ResourceBundle and MessageFormat to make specific string resources availiable.

Author:
Carolin Koehler
See Also:
ResourceBundle, MessageFormat

Constructor Summary
DefaultMessageResource(String bundleName)
          Constructor
 
Method Summary
 boolean containsKey(String key)
          Returns whether given key has a value
 boolean equals(Object obj)
          Gets whether given Object equals this MessageResource.
 String getBundleName()
          Returns the name of associated ResourceBundle.
 Enumeration getKeys()
          Returns an enumeration of all keys
 String getString(String key, Object[] parameters)
          Gets the String value for the specified key.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageResource

public DefaultMessageResource(String bundleName)
Constructor

Method Detail

getBundleName

public String getBundleName()
Returns the name of associated ResourceBundle.

Returns:
String

equals

public boolean equals(Object obj)
Gets whether given Object equals this MessageResource. This could be if its the same Object or the bundle names are equal

Overrides:
equals in class Object
See Also:
Object.equals(Object)

getString

public String getString(String key,
                        Object[] parameters)
Gets the String value for the specified key.

Specified by:
getString in interface MessageResource
Parameters:
key - identifies the value
parameters - to fill in possible placeholders
Returns:
if it was found, the value of the key, formatted, filled up with given placeholders, "" otherwise

containsKey

public boolean containsKey(String key)
Returns whether given key has a value

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

getKeys

public Enumeration getKeys()
Returns an enumeration of all keys

Specified by:
getKeys in interface MessageResource
Returns:
Enumeration


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