org.nakedobjects.utility
Class ConfigurationParameters

java.lang.Object
  extended byorg.nakedobjects.utility.ConfigurationParameters

public final class ConfigurationParameters
extends java.lang.Object

Holds the available properties for this Naked Objects session.


Constructor Summary
ConfigurationParameters()
           
 
Method Summary
 void add(java.lang.String key, java.lang.String value)
          Adds a key-value pair to this set of properties
 boolean getBoolean(java.lang.String name)
          Gets the boolean value for the specified name where no value or 'on' will result in true being returned; anything gives false.
 boolean getBoolean(java.lang.String name, boolean defaultValue)
          Gets the boolean value for the specified name.
 java.awt.Color getColor(java.lang.String name)
          Gets the color for the specified name.
 java.awt.Color getColor(java.lang.String name, java.awt.Color defaultValue)
          Gets the color for the specified name.
 java.awt.Font getFont(java.lang.String name)
          Gets the font for the specified name.
 java.awt.Font getFont(java.lang.String name, java.awt.Font defaultValue)
          Gets the font for the specified name.
static ConfigurationParameters getInstance()
          Returns the singleton that is to be used to access the properties.
 int getInteger(java.lang.String name)
          Gets the number value for the specified name.
 int getInteger(java.lang.String name, int defaultValue)
          Gets the nimber value for the specified name.
 java.util.Properties getProperties()
          Deprecated.  
 java.util.Properties getProperties(java.lang.String prefix)
          Gets the set of properties with the specified prefix
 java.lang.String getResource()
          Deprecated.  
 java.lang.String getString(java.lang.String name)
          Returns the configuration property with the specified name.
 java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
           
 boolean hasProperty(java.lang.String name)
           
 void load(java.util.Properties properties)
          Loads the properties from an existing Properties object.
 void load(java.lang.String resource)
           
 void load(java.net.URL resource)
          Loads the properties via a URL
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigurationParameters

public ConfigurationParameters()
Method Detail

getColor

public java.awt.Color getColor(java.lang.String name)
Gets the color for the specified name. If no color property is specified with this name then null is returned.

Parameters:
name - the property name

getColor

public java.awt.Color getColor(java.lang.String name,
                               java.awt.Color defaultValue)
Gets the color for the specified name. If no color property is specified with this name then the specified default color is returned.

Parameters:
name - the property name
defaultValue - the value to use as a default

getFont

public java.awt.Font getFont(java.lang.String name)
Gets the font for the specified name. If no font property is specified with this name then null is returned.

Parameters:
name - the property name

getFont

public java.awt.Font getFont(java.lang.String name,
                             java.awt.Font defaultValue)
Gets the font for the specified name. If no font property is specified with this name then the specified default font is returned.

Parameters:
name - the property name
defaultValue - the color to use as a default

getInstance

public static final ConfigurationParameters getInstance()
Returns the singleton that is to be used to access the properties.


getBoolean

public boolean getBoolean(java.lang.String name)
Gets the boolean value for the specified name where no value or 'on' will result in true being returned; anything gives false. If no boolean property is specified with this name then false is returned.

Parameters:
name - the property name

getBoolean

public boolean getBoolean(java.lang.String name,
                          boolean defaultValue)
Gets the boolean value for the specified name. If no property is specified with this name then the specified default boolean value is returned.

Parameters:
name - the property name
defaultValue - the value to use as a default

getInteger

public int getInteger(java.lang.String name,
                      int defaultValue)
Gets the nimber value for the specified name. If no property is specified with this name then the specified default number value is returned.

Parameters:
name - the property name
defaultValue - the value to use as a default

getInteger

public int getInteger(java.lang.String name)
Gets the number value for the specified name. If no property is specified with this name then 0 is returned.

Parameters:
name - the property name

getProperties

public java.util.Properties getProperties()
Deprecated.  


getProperties

public java.util.Properties getProperties(java.lang.String prefix)
Gets the set of properties with the specified prefix


getResource

public java.lang.String getResource()
Deprecated.  

Returns:
java.lang.String

getString

public java.lang.String getString(java.lang.String name)
Returns the configuration property with the specified name. If there is no matching property then null is returned.


getString

public java.lang.String getString(java.lang.String name,
                                  java.lang.String defaultValue)

add

public void add(java.lang.String key,
                java.lang.String value)
Adds a key-value pair to this set of properties

Parameters:
key -
value -

hasProperty

public boolean hasProperty(java.lang.String name)

load

public void load(java.lang.String resource)

load

public void load(java.net.URL resource)
Loads the properties via a URL

Parameters:
resource -

load

public void load(java.util.Properties properties)
Loads the properties from an existing Properties object.


toString

public java.lang.String toString()