emolib.util.conf
Interface PropertySheet


public interface PropertySheet

A property sheet defines a collection of properties for a single component in the system.


Method Summary
 void dump(java.io.PrintStream out)
          Dumps this sheet to the given stream
 boolean getBoolean(java.lang.String name, boolean defaultValue)
          Gets the value associated with this name
 Configurable getComponent(java.lang.String name, java.lang.Class type)
          Gets a component associated with the given parameter name
 java.util.List getComponentList(java.lang.String name, java.lang.Class type)
          Gets a list of components associated with the given parameter name
 double getDouble(java.lang.String name, double defaultValue)
          Gets the value associated with this name
 float getFloat(java.lang.String name, float defaultValue)
          Gets the value associated with this name
 int getInt(java.lang.String name, int defaultValue)
          Gets the value associated with this name
 java.util.logging.Logger getLogger()
          Returns a logger to use for this configurable component.
 java.lang.String[] getNames()
          Retrieves the names of all the properties currently defined for this property sheet
 ConfigurationManager getPropertyManager()
          Gets the owning property manager
 java.lang.Object getRaw(java.lang.String name)
          Gets the raw value associated with this name
 java.lang.Object getRawNoReplacment(java.lang.String name)
          Gets the raw value associated with this name, no global symbol replacement is performed.
 java.net.URL getResource(java.lang.String name)
          Gets a resource associated with the given parameter name
 java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
          Gets the value associated with this name
 java.util.List getStrings(java.lang.String name)
          Gets the list of strings associated with this name
 void setFloat(java.lang.String name, float value)
          Sets the given property to the given name
 void setInt(java.lang.String name, int value)
          Sets the given property to the given name
 void setRaw(java.lang.String key, java.lang.Object val)
          Sets the raw property to the given name
 void setString(java.lang.String name, java.lang.String value)
          Sets the given property to the given name
 

Method Detail

setString

void setString(java.lang.String name,
               java.lang.String value)
               throws PropertyException
Sets the given property to the given name

Parameters:
name - the simple property name
value - the value for the property
Throws:
PropertyException

setInt

void setInt(java.lang.String name,
            int value)
            throws PropertyException
Sets the given property to the given name

Parameters:
name - the simple property name
value - the value for the property
Throws:
PropertyException

setFloat

void setFloat(java.lang.String name,
              float value)
              throws PropertyException
Sets the given property to the given name

Parameters:
name - the simple property name
value - the value for the property
Throws:
PropertyException

getString

java.lang.String getString(java.lang.String name,
                           java.lang.String defaultValue)
                           throws PropertyException
Gets the value associated with this name

Parameters:
name - the name
defaultValue - the default value for the property
Returns:
the value
Throws:
PropertyException

setRaw

void setRaw(java.lang.String key,
            java.lang.Object val)
            throws PropertyException
Sets the raw property to the given name

Parameters:
key - the simple property name
val - the value for the property
Throws:
PropertyException

getInt

int getInt(java.lang.String name,
           int defaultValue)
           throws PropertyException
Gets the value associated with this name

Parameters:
name - the name
defaultValue - the default value for the property
Returns:
the value
Throws:
PropertyException - if the named property is not of this type

getFloat

float getFloat(java.lang.String name,
               float defaultValue)
               throws PropertyException
Gets the value associated with this name

Parameters:
name - the name
defaultValue - the default value
Returns:
the value
Throws:
PropertyException - if the named property is not of this type

getDouble

double getDouble(java.lang.String name,
                 double defaultValue)
                 throws PropertyException
Gets the value associated with this name

Parameters:
name - the name
defaultValue - the default value
Returns:
the value
Throws:
PropertyException - if the named property is not of this type

getBoolean

boolean getBoolean(java.lang.String name,
                   boolean defaultValue)
                   throws PropertyException
Gets the value associated with this name

Parameters:
name - the name
defaultValue - the default value
Returns:
the value
Throws:
PropertyException - if the named property is not of this type

getResource

java.net.URL getResource(java.lang.String name)
                         throws PropertyException
Gets a resource associated with the given parameter name

Parameters:
name - the parameter name
Returns:
the resource associated with the name or NULL if it doesn't exist.
Throws:
PropertyException - if the resource cannot be found

getComponent

Configurable getComponent(java.lang.String name,
                          java.lang.Class type)
                          throws PropertyException
Gets a component associated with the given parameter name

Parameters:
name - the parameter name
type - the desired component type
Returns:
the component associated with the name
Throws:
PropertyException - if the component does not exist or is of the wrong type.

getComponentList

java.util.List getComponentList(java.lang.String name,
                                java.lang.Class type)
                                throws PropertyException
Gets a list of components associated with the given parameter name

Parameters:
name - the parameter name
type - the desired component type
Returns:
the component associated with the name
Throws:
PropertyException - if the component does not exist or is of the wrong type.

getStrings

java.util.List getStrings(java.lang.String name)
                          throws PropertyException
Gets the list of strings associated with this name

Parameters:
name - the name
Returns:
an array (possibly empty) of configurable strings
Throws:
PropertyException - if the named property is not of this type

getNames

java.lang.String[] getNames()
Retrieves the names of all the properties currently defined for this property sheet

Returns:
the array of names

getRaw

java.lang.Object getRaw(java.lang.String name)
                        throws PropertyException
Gets the raw value associated with this name

Parameters:
name - the name
Returns:
the value as an object (it could be a String or a String[] depending upon the property type)
Throws:
PropertyException

getRawNoReplacment

java.lang.Object getRawNoReplacment(java.lang.String name)
Gets the raw value associated with this name, no global symbol replacement is performed.

Parameters:
name - the name
Returns:
the value as an object (it could be a String or a String[] depending upon the property type)

getPropertyManager

ConfigurationManager getPropertyManager()
                                        throws PropertyException
Gets the owning property manager

Returns:
the property manager
Throws:
PropertyException

getLogger

java.util.logging.Logger getLogger()
                                   throws PropertyException
Returns a logger to use for this configurable component. The logger can be configured with the property: 'logLevel' - The default logLevel value is define by the global property 'defaultLogLevel' (which defaults to WARNING).

Returns:
the logger for this component
Throws:
PropertyException - if an error occurs

dump

void dump(java.io.PrintStream out)
Dumps this sheet to the given stream

Parameters:
out - the print stream to dump the sheet on