Package net.ggtools.grand
Class Configuration
- java.lang.Object
-
- net.ggtools.grand.Configuration
-
public class Configuration extends Object
A singleton class for configuration.- Author:
- Christophe Labouisse
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedConfiguration(Properties override)Creates a new configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringget(String key)Get a parameter as a String.StringgetAntVersionString()Method getAntVersionString.PropertiesgetBuildProperties()static ConfigurationgetConfiguration()Get a configuration with the default values.static ConfigurationgetConfiguration(File propFile)Returns an new configuration overriding some parameters from a file.static ConfigurationgetConfiguration(Properties override)Returns a new configuration overriding some parameters.StringgetVersionString()
-
-
-
Constructor Detail
-
Configuration
protected Configuration(Properties override) throws IOException
Creates a new configuration. The new object's get methods will return values from the supplied properties if the demanded key exists or from the default properties in other case.- Parameters:
override- properties to override in the default configuration.- Throws:
IOException- if an error occurs in load()
-
-
Method Detail
-
getConfiguration
public static Configuration getConfiguration() throws IOException
Get a configuration with the default values.- Returns:
- new configuration
- Throws:
IOException- if the default properties were not loadable.
-
getConfiguration
public static Configuration getConfiguration(File propFile) throws IOException
Returns an new configuration overriding some parameters from a file.- Parameters:
propFile- override file- Returns:
- new configuration
- Throws:
IOException- if the default properties were not loadable.
-
getConfiguration
public static Configuration getConfiguration(Properties override) throws IOException
Returns a new configuration overriding some parameters.- Parameters:
override- the properties to override.- Returns:
- new configuration
- Throws:
IOException- if the default properties were not loadable.
-
get
public final String get(String key)
Get a parameter as a String.- Parameters:
key- parameter to look for.- Returns:
- parameter value.
-
getAntVersionString
public final String getAntVersionString()
Method getAntVersionString.- Returns:
- String
-
getBuildProperties
public final Properties getBuildProperties()
- Returns:
- Returns the buildProperties.
-
getVersionString
public final String getVersionString()
- Returns:
- Returns the versionString.
-
-