net.sf.myra.framework
Class Configuration

java.lang.Object
  extended by net.sf.myra.framework.Configuration

public final class Configuration
extends java.lang.Object

Helper class to get configuration property values.

Version:
$Revision$ $Date: 2008-02-08 15:54:20#$
Author:
Fernando Esteban Barril Otero

Field Summary
static java.lang.String CONFIG_FILE
          The property key under which the config file name is stored.
 
Method Summary
static boolean getBooleanProperty(java.lang.String key)
          Returns the property indicated by the specified key as a boolean value.
static boolean getBooleanProperty(java.lang.String key, boolean defaultValue)
          Returns the property indicated by the specified key as a boolean value.
static double getDoubleProperty(java.lang.String key)
          Returns the property indicated by the specified key as a double value.
static double getDoubleProperty(java.lang.String key, double defaultValue)
          Returns the property indicated by the specified key as an double value.
static int getIntProperty(java.lang.String key)
          Returns the property indicated by the specified key as an integer value.
static int getIntProperty(java.lang.String key, int defaultValue)
          Returns the property indicated by the specified key as an integer value.
static long getLongProperty(java.lang.String key)
          Returns the property indicated by the specified key as an long value.
static long getLongProperty(java.lang.String key, int defaultValue)
          Returns the property indicated by the specified key as an long value.
static java.util.Properties getOptions()
          Returns the configuration property options.
static java.lang.String getProperty(java.lang.String key)
          Returns the property indicated by the specified key.
static java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Returns the property indicated by the specified key.
static boolean isPresent(java.lang.String key)
          Checks if the property has a value associated.
static void setProperty(java.lang.String property, boolean value)
           
static void setProperty(java.lang.String property, java.lang.Double value)
           
static void setProperty(java.lang.String property, int value)
           
static void setProperty(java.lang.String property, long value)
           
static void setProperty(java.lang.String property, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_FILE

public static final java.lang.String CONFIG_FILE
The property key under which the config file name is stored.

See Also:
Constant Field Values
Method Detail

getProperty

public static java.lang.String getProperty(java.lang.String key)
Returns the property indicated by the specified key.

Parameters:
key - the name of the system property.
Returns:
the property indicated by the specified key, or null if there is no property with that key.

getIntProperty

public static int getIntProperty(java.lang.String key)
Returns the property indicated by the specified key as an integer value.

Parameters:
key - the name of the system property.
Returns:
the property indicated by the specified key, or null if there is no property with that key.

getLongProperty

public static long getLongProperty(java.lang.String key)
Returns the property indicated by the specified key as an long value.

Parameters:
key - the name of the system property.
Returns:
the property indicated by the specified key, or null if there is no property with that key.

getDoubleProperty

public static double getDoubleProperty(java.lang.String key)
Returns the property indicated by the specified key as a double value.

Parameters:
key - the name of the system property.
Returns:
the property indicated by the specified key.

getBooleanProperty

public static boolean getBooleanProperty(java.lang.String key)
Returns the property indicated by the specified key as a boolean value.

Parameters:
key - the name of the system property.
Returns:
the property indicated by the specified key.

getProperty

public static java.lang.String getProperty(java.lang.String key,
                                           java.lang.String defaultValue)
Returns the property indicated by the specified key.

Parameters:
key - the name of the system property.
defaultValue - a default value.
Returns:
the property indicated by the specified key, or the default value if there is no property with that key.

getIntProperty

public static int getIntProperty(java.lang.String key,
                                 int defaultValue)
Returns the property indicated by the specified key as an integer value.

Parameters:
key - the name of the system property.
defaultValue - a default value.
Returns:
the property indicated by the specified key, or the default value if there is no property with that key.

getLongProperty

public static long getLongProperty(java.lang.String key,
                                   int defaultValue)
Returns the property indicated by the specified key as an long value.

Parameters:
key - the name of the system property.
defaultValue - a default value.
Returns:
the property indicated by the specified key, or the default value if there is no property with that key.

getDoubleProperty

public static double getDoubleProperty(java.lang.String key,
                                       double defaultValue)
Returns the property indicated by the specified key as an double value.

Parameters:
key - the name of the system property.
defaultValue - a default value.
Returns:
the property indicated by the specified key, or the default value if there is no property with that key.

getBooleanProperty

public static boolean getBooleanProperty(java.lang.String key,
                                         boolean defaultValue)
Returns the property indicated by the specified key as a boolean value.

Parameters:
key - the name of the system property.
defaultValue - a default value.
Returns:
the property indicated by the specified key, or the default value if there is no property with that key.

isPresent

public static boolean isPresent(java.lang.String key)
Checks if the property has a value associated.

Parameters:
key - the property key.
Returns:
true if the property has a value associated; otherwise false.
See Also:
getProperty(String)

getOptions

public static java.util.Properties getOptions()
Returns the configuration property options.

Returns:
the configuration property options.

setProperty

public static void setProperty(java.lang.String property,
                               java.lang.String value)

setProperty

public static void setProperty(java.lang.String property,
                               boolean value)

setProperty

public static void setProperty(java.lang.String property,
                               java.lang.Double value)

setProperty

public static void setProperty(java.lang.String property,
                               int value)

setProperty

public static void setProperty(java.lang.String property,
                               long value)


Copyright © 2013. All Rights Reserved.