Package net.toddm.comm
Class MapConfigurationProvider
- java.lang.Object
-
- net.toddm.comm.MapConfigurationProvider
-
- All Implemented Interfaces:
ConfigurationProvider
- Direct Known Subclasses:
DefaultConfigurationProvider
public class MapConfigurationProvider extends Object implements ConfigurationProvider
A simple implementation of theConfigurationProviderinterface that backs configuration data with an in-memory hash map.- Author:
- Todd S. Murchison
-
-
Constructor Summary
Constructors Constructor Description MapConfigurationProvider(Map<String,Object> config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(String name)Returns true if a value with the given name exists in the configuration data, false otherwise.Objectget(String name)Returns anObjectrepresentation of the configuration value with the given name.booleangetBoolean(String name)Returns a boolean representation of the configuration value with the given name.intgetInt(String name)Returns an integer representation of the configuration value with the given name.longgetLong(String name)Returns a long representation of the configuration value with the given name.StringgetString(String name)Returns aStringrepresentation of the configuration value with the given name.
-
-
-
Method Detail
-
contains
public boolean contains(String name)
Returns true if a value with the given name exists in the configuration data, false otherwise.- Specified by:
containsin interfaceConfigurationProvider
-
get
public Object get(String name) throws ConfigurationException
Returns anObjectrepresentation of the configuration value with the given name. If no such value exists aConfigurationExceptionis thrown.- Specified by:
getin interfaceConfigurationProvider- Throws:
ConfigurationException
-
getString
public String getString(String name) throws ConfigurationException
Returns aStringrepresentation of the configuration value with the given name. If no such value exists or the value can not be interpreted as a String aConfigurationExceptionis thrown.- Specified by:
getStringin interfaceConfigurationProvider- Throws:
ConfigurationException
-
getInt
public int getInt(String name) throws ConfigurationException
Returns an integer representation of the configuration value with the given name. If no such value exists or the value can not be interpreted as an int aConfigurationExceptionis thrown.- Specified by:
getIntin interfaceConfigurationProvider- Throws:
ConfigurationException
-
getLong
public long getLong(String name) throws ConfigurationException
Returns a long representation of the configuration value with the given name. If no such value exists or the value can not be interpreted as a long aConfigurationExceptionis thrown.- Specified by:
getLongin interfaceConfigurationProvider- Throws:
ConfigurationException
-
getBoolean
public boolean getBoolean(String name) throws ConfigurationException
Returns a boolean representation of the configuration value with the given name. If no such value exists or the value can not be interpreted as a boolean aConfigurationExceptionis thrown.- Specified by:
getBooleanin interfaceConfigurationProvider- Throws:
ConfigurationException
-
-