org.nakedobjects.metamodel.config.internal
Class PropertiesConfiguration

java.lang.Object
  extended by org.nakedobjects.metamodel.config.internal.PropertiesConfiguration
All Implemented Interfaces:
Injectable, DebugInfo, NakedObjectConfiguration

public class PropertiesConfiguration
extends java.lang.Object
implements NakedObjectConfiguration


Constructor Summary
PropertiesConfiguration()
           
PropertiesConfiguration(ResourceStreamSource resourceStreamSource)
           
 
Method Summary
 void add(java.util.Properties properties)
          Add the properties from an existing Properties object.
 void add(java.lang.String key, java.lang.String value)
          Adds a key-value pair to this set of properties
 NakedObjectConfiguration createSubset(java.lang.String prefix)
          Creates a new NakedObjectConfiguration containing the properties starting with the specified prefix.
 void debugData(DebugString str)
          Debug details describing the object being investigated
 java.lang.String debugTitle()
          The title for the debug information
 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.
 int getInteger(java.lang.String name)
          Gets the number value for the specified name.
 int getInteger(java.lang.String name, int defaultValue)
          Gets the number value for the specified name.
 java.lang.String[] getList(java.lang.String name)
          Returns a list of entries for the single configuration property with the specified name.
 NakedObjectConfiguration getProperties(java.lang.String withPrefix)
          Creates a new NakedObjectConfiguration containing the properties starting with the specified prefix.
 ResourceStreamSource getResourceStreamSource()
          The ResourceStreamSource that was used to build this configuration.
 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 injectInto(java.lang.Object candidate)
          Will inject itself into the candidate if the candidate implements the corresponding *Aware type.
 boolean isEmpty()
           
 java.util.Enumeration<java.lang.String> propertyNames()
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertiesConfiguration

public PropertiesConfiguration()

PropertiesConfiguration

public PropertiesConfiguration(ResourceStreamSource resourceStreamSource)
Method Detail

getResourceStreamSource

public ResourceStreamSource getResourceStreamSource()
Description copied from interface: NakedObjectConfiguration
The ResourceStreamSource that was used to build this configuration.

This replaces the old rootPath() method.

Specified by:
getResourceStreamSource in interface NakedObjectConfiguration
See Also:
ConfigurationBuilder.getResourceStreamSource()

add

public void add(java.util.Properties properties)
Add the properties from an existing Properties object.


add

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

Specified by:
add in interface NakedObjectConfiguration

createSubset

public NakedObjectConfiguration createSubset(java.lang.String prefix)
Description copied from interface: NakedObjectConfiguration
Creates a new NakedObjectConfiguration containing the properties starting with the specified prefix. The names of the new properties will have the prefixed stripped. This is similar to the NakedObjectConfiguration.getProperties(String) method, except the property names have their prefixes removed.

Specified by:
createSubset in interface NakedObjectConfiguration
See Also:
NakedObjectConfiguration.getProperties(String)

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.

Specified by:
getBoolean in interface NakedObjectConfiguration
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.

Specified by:
getBoolean in interface NakedObjectConfiguration
Parameters:
name - the property name
defaultValue - the value to use as a default

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.

Specified by:
getColor in interface NakedObjectConfiguration
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.

Specified by:
getColor in interface NakedObjectConfiguration
Parameters:
name - the property name
defaultValue - the value to use as a default

debugData

public void debugData(DebugString str)
Description copied from interface: DebugInfo
Debug details describing the object being investigated

Specified by:
debugData in interface DebugInfo

debugTitle

public java.lang.String debugTitle()
Description copied from interface: DebugInfo
The title for the debug information

Specified by:
debugTitle in interface DebugInfo

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.

Specified by:
getFont in interface NakedObjectConfiguration
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.

Specified by:
getFont in interface NakedObjectConfiguration
Parameters:
name - the property name
defaultValue - the color 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.

Specified by:
getInteger in interface NakedObjectConfiguration
Parameters:
name - the property name

getInteger

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

Specified by:
getInteger in interface NakedObjectConfiguration
Parameters:
name - the property name
defaultValue - the value to use as a default

getList

public java.lang.String[] getList(java.lang.String name)
Description copied from interface: NakedObjectConfiguration
Returns a list of entries for the single configuration property with the specified name.

If there is no matching property then returns an empty array.

Specified by:
getList in interface NakedObjectConfiguration

getProperties

public NakedObjectConfiguration getProperties(java.lang.String withPrefix)
Description copied from interface: NakedObjectConfiguration
Creates a new NakedObjectConfiguration containing the properties starting with the specified prefix. The names of the properties in the copy are the same as in the original, ie the prefix is not removed. This is similar to the NakedObjectConfiguration.createSubset(String) method except the names of the properties are not altered when copied.

Specified by:
getProperties in interface NakedObjectConfiguration
See Also:
NakedObjectConfiguration.createSubset(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.

Specified by:
getString in interface NakedObjectConfiguration

getString

public java.lang.String getString(java.lang.String name,
                                  java.lang.String defaultValue)
Specified by:
getString in interface NakedObjectConfiguration

hasProperty

public boolean hasProperty(java.lang.String name)
Specified by:
hasProperty in interface NakedObjectConfiguration

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface NakedObjectConfiguration

propertyNames

public java.util.Enumeration<java.lang.String> propertyNames()
Specified by:
propertyNames in interface NakedObjectConfiguration

size

public int size()
Specified by:
size in interface NakedObjectConfiguration

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

injectInto

public void injectInto(java.lang.Object candidate)
Description copied from interface: Injectable
Will inject itself into the candidate if the candidate implements the corresponding *Aware type.

Specified by:
injectInto in interface Injectable


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.