slib.utils.i
Class Conf

java.lang.Object
  extended by slib.utils.i.Conf

public class Conf
extends Object

Generic Configuration class used to build object storing a configuration as key value pairs. Conf objects are defined by a map storing pair of keys and values in which the key is a String corresponding to the flag of the parameter and the value is an Object corresponding to the value associated to the related key.

Author:
Sebastien Harispe

Constructor Summary
Conf()
           
 
Method Summary
 Conf addParam(String p, Object v)
          Add the parameter to the configuration Override existing parameter if one exists.
 boolean containsParam(String p)
          Return true if the given parameter is stored in the current configuration.
 boolean containsParams()
          Check if the configuration contains at least one parameter.
 Object getParam(String p)
          Return the value associated to the given parameter as an Object.
 double getParamAsDouble(String p)
          Return the value associated to the given parameter as a double value.
 String getParamAsString(String p)
          Return the value associated to the given parameter as aString.
 Map<String,Object> getParams()
          Getter of the Map storing the entry loaded in the configuration.
 void removeParam(String p)
          Remove the entry corresponding to the given key if one is stored.
 void setParams(HashMap<String,Object> params)
          Set the current map to the given.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Conf

public Conf()
Method Detail

getParamAsString

public String getParamAsString(String p)
Return the value associated to the given parameter as aString.

Parameters:
p - the flag of the parameter you want to retrieve the value.
Returns:
the value associated to the given parameter flag or null if no parameter corresponding to the queried flag is stored.

getParam

public Object getParam(String p)
Return the value associated to the given parameter as an Object.

Parameters:
p - the flag of the parameter you want to retrieve the value.
Returns:
the value associated to the given parameter flag or null if no parameter corresponding to the queried flag is stored.

getParamAsDouble

public double getParamAsDouble(String p)
                        throws SLIB_Ex_Critic
Return the value associated to the given parameter as a double value.

Parameters:
p - the flag of the parameter
Returns:
the value associated to the given key as a double
Throws:
SLIB_Ex_Critic

containsParam

public boolean containsParam(String p)
Return true if the given parameter is stored in the current configuration.

Parameters:
p - the parameter flag
Returns:
true if the configuration map contains a key mapping the given flag.

addParam

public Conf addParam(String p,
                     Object v)
Add the parameter to the configuration Override existing parameter if one exists.

Parameters:
p - the parameter flag
v - the value associated
Returns:
the configuration object from which the method is called (auto complete feature)

removeParam

public void removeParam(String p)
Remove the entry corresponding to the given key if one is stored.

Parameters:
p - the key to process.

getParams

public Map<String,Object> getParams()
Getter of the Map storing the entry loaded in the configuration.

Returns:
the loaded map.

setParams

public void setParams(HashMap<String,Object> params)
Set the current map to the given.

Parameters:
params - the new map defining the configuration.

containsParams

public boolean containsParams()
Check if the configuration contains at least one parameter.

Returns:
true if at least a parameter is loaded.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.