org.castor.ddlgen

Class Configuration

Known Direct Subclasses:
DDLGenConfiguration

public class Configuration
extends java.lang.Object

Handle the configuration for DDL generator including load configuration files, manage configuration values.
Version:
$Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Authors:
Le Duc Bao
Ralf Joachim
Since:
1.1

Field Summary

static String
FALSE
String representation of boolean false.
static String
TRUE
String representation of boolean true.

Constructor Summary

Configuration()
Constructor for Configuration.

Method Summary

void
addProperties(Properties props)
add properties (key, value) for configuration, the existed item will be overwrited.
void
addProperties(String filename)
add properties (key, value) for configuration, the existed item will be overwrited.
boolean
getBoolValue(String key)
get boolean value associated with key in the configuration files.
boolean
getBoolValue(String key, boolean defaultValue)
get boolean value associated with key in the configuration files.
Integer
getInteger(String name)
Get property with given name as Integer value.
String
getStringValue(String key)
get String value associated with key in the configuration files.
String
getStringValue(String key, String defaultValue)
get String value associated with key in the configuration files.
void
setProperty(String key, String value)
set property value, this will overwrite the loaded value.

Field Details

FALSE

public static final String FALSE
String representation of boolean false.

TRUE

public static final String TRUE
String representation of boolean true.

Constructor Details

Configuration

public Configuration()
Constructor for Configuration.

Method Details

addProperties

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

addProperties

public final void addProperties(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

getBoolValue

public final boolean getBoolValue(String key)
            throws WrongFormatException,
                   KeyNotFoundException
get boolean value associated with key in the configuration files.
Parameters:
key - key
Returns:
return value associated with key. If not exists, throw an exception
Throws:
WrongFormatException - format error
KeyNotFoundException - key error

getBoolValue

public final boolean getBoolValue(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 Integer getInteger(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 String getStringValue(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 String getStringValue(String key,
                                   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

setProperty

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

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com