de.beamertool.util
Class ExtProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by de.beamertool.util.ExtProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class ExtProperties
extends Properties

This class extends Properties with methods to put and get Colors, Integers, Fonts, Lists, Maps and Boolean values. Internal these values are saved as Strings. So be careful while editing the saved properties file. Otherwise the transaltion from string back to value might fail.

Author:
ocm-zeeman
See Also:
Serialized Form

Constructor Summary
ExtProperties()
          Constructs an empty Extproperties
ExtProperties(Properties defaults)
          Constructs an Extproperties with the given defaults
 
Method Summary
 Object clone()
           
 boolean getBoolean(String key)
          Gets the boolean value of the given key
 boolean getBoolean(String key, Boolean defaultValue)
          Gets the boolean value of the given key
 Collection<String> getCollection(String key)
          Gets the collection of the given key
 Collection<String> getCollection(String key, Collection<String> defaultValue)
          Gets the collection of the given key
 Color getColor(String key)
          Gets the Color value of the given key
 Color getColor(String key, Color defaultValue)
          Gets the Color value of the given key
 CommPort getCommPort(String key)
           
 CommPort getCommPort(String key, CommPort defaultValue)
           
 Font getFont(String key)
          Gets the font value of the given key
 Font getFont(String key, Font defaultValue)
          Gets the Font value of the given key
 int getInteger(String key)
          Gets the integer value of the given key
 int getInteger(String key, Integer defaultValue)
          Gets the integer value of the given key
 Map<String,String> getMap(String key)
          Gets the map of the given key
 Map<String,String> getMap(String key, Map<String,String> defaultValue)
          Gets the map of the given key
 MessageOrientation getMessageOrientation(String key)
           
 MessageOrientation getMessageOrientation(String key, MessageOrientation defaultValue)
           
 MessagePresentation getMessagePresentation(String key)
           
 MessagePresentation getMessagePresentation(String key, MessagePresentation defaultValue)
           
 MobileType getMobileType(String key)
          Gets the mobile type of the given key
 MobileType getMobileType(String key, MobileType defaultValue)
          Gets the mobile type of the given key
 String getString(String key)
          Wrapper around getProperty for nameing reasons
 String getString(String key, String defaultValue)
          Wrapper around getProperty for nameing reasons
 void putBoolean(String key, Boolean value)
          Saves the given boolean under key.
 void putCollection(String key, Collection<String> value)
          Saves the given list under key.
 void putColor(String key, Color value)
          Saves the given Color under key.
 void putCommPort(String key, CommPort value)
           
 void putFont(String key, Font value)
          Saves the given Font under key.
 void putInteger(String key, Integer value)
          Saves the given integer under key.
 void putMap(String key, Map<String,String> value)
          Saves the given map under key.
 void putMessageOrientation(String key, MessageOrientation value)
           
 void putMessagePresentation(String key, MessagePresentation value)
           
 void putMobileType(String key, MobileType value)
          Saves the given mobile type under key.
 void putString(String key, String value)
          Wrapper around setProperty for nameing reasons
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExtProperties

public ExtProperties()
Constructs an empty Extproperties

See Also:
Properties.Properties()

ExtProperties

public ExtProperties(Properties defaults)
Constructs an Extproperties with the given defaults

Parameters:
defaults -
See Also:
Properties.Properties(Properties)
Method Detail

clone

public Object clone()
Overrides:
clone in class Hashtable<Object,Object>

getBoolean

public boolean getBoolean(String key)
Gets the boolean value of the given key

Parameters:
key - - The key of the requested value
Returns:
the value or false if the key is not found

getBoolean

public boolean getBoolean(String key,
                          Boolean defaultValue)
Gets the boolean value of the given key

Parameters:
key - - The key of the requested value
defaultValue - - The default value if the key is not found
Returns:
the value or defaultValue if the key is not found

getCollection

public Collection<String> getCollection(String key)
Gets the collection of the given key

Parameters:
key - - The key of the requested value
Returns:
the value or null if the key is not found

getCollection

public Collection<String> getCollection(String key,
                                        Collection<String> defaultValue)
Gets the collection of the given key

Parameters:
key - - The key of the requested value
defaultValue - - The default value if the key is not found
Returns:
the value or defaultValue if the key is not found

getColor

public Color getColor(String key)
Gets the Color value of the given key

Parameters:
key - - The key of the requested value
Returns:
the value or null if the key is not found

getColor

public Color getColor(String key,
                      Color defaultValue)
Gets the Color value of the given key

Parameters:
key - - The key of the requested value
defaultValue - - The default value if the key is not found
Returns:
the value or defaultValue if the key is not found

getCommPort

public CommPort getCommPort(String key)

getCommPort

public CommPort getCommPort(String key,
                            CommPort defaultValue)

getFont

public Font getFont(String key)
Gets the font value of the given key

Parameters:
key - - The key of the requested value
Returns:
the value or null if the key is not found

getFont

public Font getFont(String key,
                    Font defaultValue)
Gets the Font value of the given key

Parameters:
key - - The key of the requested value
defaultValue - - The default value if the key is not found
Returns:
the value or defaultValue if the key is not found

getInteger

public int getInteger(String key)
Gets the integer value of the given key

Parameters:
key - - The key of the requested value
Returns:
the value or 0 if the key is not found

getInteger

public int getInteger(String key,
                      Integer defaultValue)
Gets the integer value of the given key

Parameters:
key - - The key of the requested value
defaultValue - - The default value if the key is not found
Returns:
the value or defaultValue if the key is not found

getMap

public Map<String,String> getMap(String key)
Gets the map of the given key

Parameters:
key - - The key of the requested value
Returns:
the value or null if the key is not found

getMap

public Map<String,String> getMap(String key,
                                 Map<String,String> defaultValue)
Gets the map of the given key

Parameters:
key - - The key of the requested value
defaultValue - - The default value if the key is not found
Returns:
the value or defaultValue if the key is not found

getMessageOrientation

public MessageOrientation getMessageOrientation(String key)

getMessageOrientation

public MessageOrientation getMessageOrientation(String key,
                                                MessageOrientation defaultValue)

getMessagePresentation

public MessagePresentation getMessagePresentation(String key)

getMessagePresentation

public MessagePresentation getMessagePresentation(String key,
                                                  MessagePresentation defaultValue)

getMobileType

public MobileType getMobileType(String key)
Gets the mobile type of the given key

Parameters:
key - - The key of the requested value or null if the key isn't found
Returns:
the value or defaultValue if the key is not found

getMobileType

public MobileType getMobileType(String key,
                                MobileType defaultValue)
Gets the mobile type of the given key

Parameters:
key - - The key of the requested value
defaultValue - - The default value if the key is not found
Returns:
the value or defaultValue if the key is not found

getString

public String getString(String key)
Wrapper around getProperty for nameing reasons

See Also:
Properties.getProperty(String)

getString

public String getString(String key,
                        String defaultValue)
Wrapper around getProperty for nameing reasons

See Also:
Properties.getProperty(String, String)

putBoolean

public void putBoolean(String key,
                       Boolean value)
Saves the given boolean under key. Internal it's saved as string

Parameters:
key - - The key as the value is saved for
value - - The value which is saved

putCollection

public void putCollection(String key,
                          Collection<String> value)
Saves the given list under key. Internal it's saved as string

Parameters:
key - - The key as the value is saved for
value - - The value which is saved

putColor

public void putColor(String key,
                     Color value)
Saves the given Color under key. Internal it's saved as string

Parameters:
key - - The key as the value is saved for
value - - The value which is saved

putCommPort

public void putCommPort(String key,
                        CommPort value)

putFont

public void putFont(String key,
                    Font value)
Saves the given Font under key. Internal it's saved as string

Parameters:
key - - The key as the value is saved for
value - - The value which is saved

putInteger

public void putInteger(String key,
                       Integer value)
Saves the given integer under key. Internal it's saved as string

Parameters:
key - - The key as the value is saved for
value - - The value which is saved

putMap

public void putMap(String key,
                   Map<String,String> value)
Saves the given map under key. Internal it's saved as string

Parameters:
key - - The key as the value is saved for
value - - The value which is saved

putMessageOrientation

public void putMessageOrientation(String key,
                                  MessageOrientation value)

putMessagePresentation

public void putMessagePresentation(String key,
                                   MessagePresentation value)

putMobileType

public void putMobileType(String key,
                          MobileType value)
Saves the given mobile type under key. Internal it's saved as string

Parameters:
key - - The key as the value is saved for
value - - The value which is saved

putString

public void putString(String key,
                      String value)
Wrapper around setProperty for nameing reasons

See Also:
Properties.setProperty(String, String)