: Class Config

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ## TsBiff 1.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ts.config
Class Config

    java.lang.Object
      |
      +--ts.config.Config

public final class Config
extends java.lang.Object

This final class holds universal application properties, as well as java default properties from java.lang.System. The class uses a static initializer to load default properties at loadtime. Using the singleton pattern to have only one instance of Config.

Version:
  $Id: Config.java,v 1.12 1999/06/09 18:55:54 hauk Exp $
Author:
  Jan-Henrik Haukeland <hauk@tildeslash.com>

Field Summary
`static int` | `NO_INT_VALUE`

Method Summary
`static java.lang.String` | `get(java.lang.String key)` Get String value for given property.
`static java.lang.String` | `get(java.lang.String key, java.lang.String def)` Get String value for given property.
`static boolean` | `getboolean(java.lang.String key)` Get boolean value for given property
`static java.lang.Boolean` | `getBoolean(java.lang.String key)` Get Boolean value for given property
`static boolean` | `getboolean(java.lang.String key, boolean def)` Get boolean value for given property.
`static java.lang.Boolean` | `getBoolean(java.lang.String key, java.lang.Boolean def)` Get Boolean value for given property.
`static java.awt.Color` | `getColor(java.lang.String key)` Get Color value for given property.
`static java.lang.String[]` | `getCValues(java.lang.String key)` Get a String array for the given property.
`static java.awt.Font` | `getFont(java.lang.String key)` Get Font value for given property.
`static Config` | `getInstance()` Returns the Config instance singleton
`static int` | `getint(java.lang.String key)` Get int value for given property.
`static int` | `getint(java.lang.String key, int def)` Get int value for given property.
`static java.lang.Integer` | `getInteger(java.lang.String key)` Get Integer value for given property.
`static java.lang.Integer` | `getInteger(java.lang.String key, java.lang.Integer def)` Get Integer value for given property.
`static int[]` | `getIntValues(java.lang.String key)` Get an int array for the given property.
`static java.lang.String[]` | `getValues(java.lang.String key)` Get a String array for the given property.
`void` | `list()` List properties to stdout
`void` | `load(java.io.File file)` Load properties from file.
`void` | `load(java.lang.String file)` Load properties from file using filename as locator
`void` | `save(java.io.File file)` Save properties to the submitted File
`void` | `save(java.lang.String file)` Save properties to the submitted filename
`static void` | `set(java.lang.String key, java.lang.String value)` Set value for given property.
`java.lang.String` | `toString()` Composes string containing all properties and their values

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### NO_INT_VALUE

    public static int NO_INT_VALUE

Method Detail

### getInstance

    public static Config getInstance()

  Returns the Config instance singleton
  Returns:
    a Config singelton instance

### load

    public void load(java.io.File file)
              throws ConfigException

  Load properties from file. Existing properties will be replaced with new key/value pair if defined in file.
  Parameters:
    `file` - A properties File object
  Throws:
    `ConfigException` - if invalid file

### load

    public void load(java.lang.String file)
              throws ConfigException

  Load properties from file using filename as locator
  Parameters:
    `file` - A string containing a filename
  Throws:
    `ConfigException` - if invalid file

### save

    public void save(java.io.File file)
              throws ConfigException

  Save properties to the submitted File
  Throws:
    `ConfigException` - if could not save properties file

### save

    public void save(java.lang.String file)
              throws ConfigException

  Save properties to the submitted filename
  Throws:
    `ConfigException` - if could not save properties file

### set

    public static void set(java.lang.String key,
                           java.lang.String value)

  Set value for given property.
  Parameters:
    `key` - a key
    `value` - the value for the key

### getValues

    public static java.lang.String[] getValues(java.lang.String key)

  Get a String array for the given property. The key is supposed to have a value with whitespace separated sub-strings.
  Parameters:
    `key` - A key
  Returns:
    A String array with values

### getCValues

    public static java.lang.String[] getCValues(java.lang.String key)

  Get a String array for the given property. The key is supposed to have a value with comma separated sub-strings.
  Parameters:
    `key` - A key
  Returns:
    A String array with values

### getIntValues

    public static int[] getIntValues(java.lang.String key)

  Get an int array for the given property. The key is supposed to have a list of int values. This method returns a null int array If a value is not an int, or if there's no value.
  Parameters:
    `key` - A key
  Returns:
    A String array with values

### get

    public static java.lang.String get(java.lang.String key)

  Get String value for given property.
  Parameters:
    `key` - A key
  Returns:
    A String value for the key

### get

    public static java.lang.String get(java.lang.String key,
                                       java.lang.String def)

  Get String value for given property. If no value is found return the given default value.
  Parameters:
    `key` - A key
    `def` - the default value to return if no value is found
  Returns:
    A String value for the key

### getInteger

    public static java.lang.Integer getInteger(java.lang.String key)

  Get Integer value for given property.
  Parameters:
    `key` - A key
  Returns:
    An Integer value for the key

### getInteger

    public static java.lang.Integer getInteger(java.lang.String key,
                                               java.lang.Integer def)

  Get Integer value for given property. If no value is found return the given default value.
  Parameters:
    `key` - A key
    `def` - the default value to return if no value is found
  Returns:
    An Integer value for the key

### getBoolean

    public static java.lang.Boolean getBoolean(java.lang.String key)

  Get Boolean value for given property
  Parameters:
    `key` - A key
  Returns:
    A value for the key

### getBoolean

    public static java.lang.Boolean getBoolean(java.lang.String key,
                                               java.lang.Boolean def)

  Get Boolean value for given property. If no value is found return the given default value.
  Parameters:
    `key` - A key
    `def` - the default value to return if no value is found
  Returns:
    A value for the key

### getFont

    public static java.awt.Font getFont(java.lang.String key)

  Get Font value for given property. If no value is found return Font(sanserif-plan-12) as default value.
  Parameters:
    `key` - A key
  Returns:
    A value for the key

### getColor

    public static java.awt.Color getColor(java.lang.String key)

  Get Color value for given property. If no value is found return Color.black as default value.
  Parameters:
    `key` - A key
  Returns:
    A value for the key

### getint

    public static int getint(java.lang.String key)

  Get int value for given property. If no value is found return NO_INT_VALUE;
  Parameters:
    `key` - A key
  Returns:
    An int value for the key

### getint

    public static int getint(java.lang.String key,
                             int def)

  Get int value for given property. If no value is found return the given default value.
  Parameters:
    `key` - A key
    `def` - the default value to return if no value is found
  Returns:
    An int value for the key

### getboolean

    public static boolean getboolean(java.lang.String key)

  Get boolean value for given property
  Parameters:
    `key` - A key
  Returns:
    A primitive boolean value for the key

### getboolean

    public static boolean getboolean(java.lang.String key,
                                     boolean def)

  Get boolean value for given property. If no value is found return the given default value.
  Parameters:
    `key` - A key
    `def` - the default value to return if no value is found
  Returns:
    A primitive boolean value for the key

### toString

    public java.lang.String toString()

  Composes string containing all properties and their values
  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A string with the content nicely formated

### list

    public void list()

  List properties to stdout

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ## TsBiff 1.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD