Class Configuration

  • Direct Known Subclasses:
    DDLGenConfiguration

    public class Configuration
    extends java.lang.Object
    Handle the configuration for DDL generator including load configuration files, manage configuration values.
    Since:
    1.1
    Version:
    $Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
    Author:
    Le Duc Bao, Ralf Joachim
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String FALSE
      String representation of boolean false.
      static java.lang.String TRUE
      String representation of boolean true.
    • Constructor Summary

      Constructors 
      Constructor Description
      Configuration()
      Constructor for Configuration.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addProperties​(java.lang.String filename)
      add properties (key, value) for configuration, the existed item will be overwrited.
      void addProperties​(java.util.Properties props)
      add properties (key, value) for configuration, the existed item will be overwrited.
      boolean getBoolValue​(java.lang.String key)
      get boolean value associated with key in the configuration files.
      boolean getBoolValue​(java.lang.String key, boolean defaultValue)
      get boolean value associated with key in the configuration files.
      java.lang.Integer getInteger​(java.lang.String name)
      Get property with given name as Integer value.
      java.lang.String getStringValue​(java.lang.String key)
      get String value associated with key in the configuration files.
      java.lang.String getStringValue​(java.lang.String key, java.lang.String defaultValue)
      get String value associated with key in the configuration files.
      void setProperty​(java.lang.String key, java.lang.String value)
      set property value, this will overwrite the loaded value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TRUE

        public static final java.lang.String TRUE
        String representation of boolean true.
        See Also:
        Constant Field Values
      • FALSE

        public static final java.lang.String FALSE
        String representation of boolean false.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Configuration

        public Configuration()
        Constructor for Configuration.
    • Method Detail

      • getBoolValue

        public final boolean getBoolValue​(java.lang.String key,
                                          boolean defaultValue)
        get boolean value associated with key in the configuration files.
        Parameters:
        key - key
        defaultValue - default value
        Returns:
        return value associated with key. If not exists, return the default value
      • getInteger

        public final java.lang.Integer getInteger​(java.lang.String name)
        Get property with given name as Integer value. If property is not available or can not be interpreted as integer null will be returned.
        Parameters:
        name - Name of the property.
        Returns:
        The configured Integer property or null if property is not available or can not be interpreted as integer.
      • getStringValue

        public final java.lang.String getStringValue​(java.lang.String key)
                                              throws KeyNotFoundException
        get String value associated with key in the configuration files.
        Parameters:
        key - key
        Returns:
        return value associated with key. If not exists, throw an exception
        Throws:
        KeyNotFoundException - key error
      • getStringValue

        public final java.lang.String getStringValue​(java.lang.String key,
                                                     java.lang.String defaultValue)
        get String value associated with key in the configuration files.
        Parameters:
        key - key
        defaultValue - default value
        Returns:
        return value associated with key. If not exists, return default value
      • addProperties

        public final void addProperties​(java.util.Properties props)
        add properties (key, value) for configuration, the existed item will be overwrited.
        Parameters:
        props - properties
      • addProperties

        public final void addProperties​(java.lang.String filename)
                                 throws GeneratorException
        add properties (key, value) for configuration, the existed item will be overwrited.
        Parameters:
        filename - a properties file
        Throws:
        GeneratorException - generator error
      • setProperty

        public final void setProperty​(java.lang.String key,
                                      java.lang.String value)
        set property value, this will overwrite the loaded value.
        Parameters:
        key - key
        value - value