Class Configuration
java.lang.Object
fr.ens.biologie.genomique.aozan.aozan3.Configuration
- Direct Known Subclasses:
RunConfiguration
This class define a configuration
- Since:
- 3.0
- Author:
- Laurent Jourdren
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) Test if configuration contains a key.Get the value for a configuration key.Get the value for a configuration key.booleangetBoolean(String key) Get a boolean configuration key.booleangetBoolean(String key, boolean defaultValue) Get a boolean value for a configuration key.doubleGet a double configuration key.doubleGet a double value for a configuration key.intGet an int configuration key.intGet an integer value for a configuration key.longGet a long configuration key.longGet a long value for a configuration key.Get Path configuration key.Get a Path value for a configuration key.booleanisEmpty()Test if the configuration is empty.voidLoad configuration.voidLoad configuration.voidParse a string (e.g.voidset(Configuration conf) Add all the keys and value of a Configuration object in this one.voidSet a value.voidSet a value.voidSet a value.voidsetFromOtherConf(Configuration conf, String key) Set a value from the value of another configuration.voidsetFromOtherConf(Configuration conf, String key, String defaultValue) Set a value from the value of another configuration.voidsetFromOtherConfIfExists(Configuration conf, String key) Set a value from the value of another configuration.voidsetIfNotExists(String key, boolean value) Set a value if key does not exists.voidsetIfNotExists(String key, Number value) Set a value if key does not exists.voidsetIfNotExists(String key, String value) Set a value if key does not exists.intsize()Return the size of the configuration.toMap()Convert the configuration as a Map.toString()
-
Constructor Details
-
Configuration
public Configuration()Default constructor. -
Configuration
Constructor.- Parameters:
conf- configuration to copy
-
-
Method Details
-
containsKey
Test if configuration contains a key.- Parameters:
key- the key to test- Returns:
- true if the configuration contains the key
-
get
Get the value for a configuration key.- Parameters:
key- the key. The key must exists- Returns:
- a String with the value
-
getBoolean
Get a boolean configuration key.- Parameters:
key- the key The key must exists- Returns:
- a boolean value
-
getInt
Get an int configuration key.- Parameters:
key- the key The key must exists- Returns:
- a integer value
-
getLong
Get a long configuration key.- Parameters:
key- the key The key must exists- Returns:
- a long value
-
getDouble
Get a double configuration key.- Parameters:
key- the key The key must exists- Returns:
- a double value
-
getPath
Get Path configuration key.- Parameters:
key- the key The key must exists- Returns:
- a Path value
-
get
Get the value for a configuration key.- Parameters:
key- the keydefaultValue- value if the key does not exists- Returns:
- a String with the value
-
getBoolean
Get a boolean value for a configuration key.- Parameters:
key- the keydefaultValue- value if the key does not exists- Returns:
- a String with the value
-
getInt
Get an integer value for a configuration key.- Parameters:
key- the keydefaultValue- value if the key does not exists- Returns:
- a integer
-
getLong
Get a long value for a configuration key.- Parameters:
key- the keydefaultValue- value if the key does not exists- Returns:
- a long
-
getDouble
Get a double value for a configuration key.- Parameters:
key- the keydefaultValue- value if the key does not exists- Returns:
- a double
-
getPath
Get a Path value for a configuration key.- Parameters:
key- the keydefaultValue- value if the key does not exists- Returns:
- a Path
-
set
Set a value.- Parameters:
key- the keyvalue- the value
-
setIfNotExists
Set a value if key does not exists.- Parameters:
key- the keyvalue- the value
-
set
Set a value.- Parameters:
key- the keyvalue- the value
-
setIfNotExists
Set a value if key does not exists.- Parameters:
key- the keyvalue- the value
-
set
Set a value.- Parameters:
key- the keyvalue- the value
-
setIfNotExists
Set a value if key does not exists.- Parameters:
key- the keyvalue- the value
-
set
Add all the keys and value of a Configuration object in this one.- Parameters:
conf- the configuration to add
-
setFromOtherConf
Set a value from the value of another configuration.- Parameters:
conf- the configuration where retriving the valuekey- the ley
-
setFromOtherConfIfExists
Set a value from the value of another configuration.- Parameters:
conf- the configuration where retriving the valuekey- the ley
-
setFromOtherConf
Set a value from the value of another configuration.- Parameters:
conf- the configuration where retrieving the valuekey- the keydefaultValue- value if the key does not exists
-
parseAndSet
Parse a string (e.g. key=value) and set the key and value in the configuration.- Parameters:
s- String to parse
-
toMap
Convert the configuration as a Map.- Returns:
- a copy of the configuration object in a map
-
size
public int size()Return the size of the configuration.- Returns:
- the number of elements in the configuration
-
isEmpty
public boolean isEmpty()Test if the configuration is empty.- Returns:
- true if the configuration is empty
-
toString
-
load
Load configuration.- Parameters:
file- file to save- Throws:
Aozan3Exception- if an error occurs while reading the file
-
load
Load configuration.- Parameters:
file- file to save- Throws:
Aozan3Exception- if an error occurs while reading the file
-