com.sdm.quasar.client.core.common.config
Interface ConfigProvider

All Known Subinterfaces:
ConfigManager, ConfigProviderService
All Known Implementing Classes:
DefaultConfigManager, DefaultConfigProviderService

public interface ConfigProvider

Provides access to configuration.

Version:
1.0
Author:
Martin Haft, sd&m AG, Carsten Lucke, sd&m AG, Bernd Olleck, sd&m AG

Method Summary
 Configuration getConfiguration(java.lang.Class configurationClass)
          Returns the implementation for the given interface class.
 java.lang.Object getValue(java.lang.Class keyClass)
          Returns the Object implementing a given interface.
 java.lang.Object getValue(java.lang.String key)
          Returns the Object corresponding to the given configuration key.
 boolean hasConfiguration(java.lang.Class configurationClass)
          Returns true, if there is a Configuration stored under the given configuration key class.
 java.lang.Object requireValue(java.lang.Class keyClass)
          Returns the Object implementing a given interface.
 

Method Detail

getValue

public java.lang.Object getValue(java.lang.String key)
Returns the Object corresponding to the given configuration key. If the key is unknown, null will be returned. Values may be added using one of the add-methods of the ConfigManager.

Parameters:
key - the key to the configuration entry (not null)
Returns:
the value of the configuration entry, may be null.

getValue

public java.lang.Object getValue(java.lang.Class keyClass)
Returns the Object implementing a given interface. This can be used as a global registry for implementations that are not Services.

Parameters:
keyClass - the class of the interface
Returns:
the registered implementation corresponding to the interface or null if there is no implementation registered for that interface

requireValue

public java.lang.Object requireValue(java.lang.Class keyClass)
Returns the Object implementing a given interface. In opposite to getValue(Class), throws an exception if the value is not contained.

Parameters:
keyClass - the class of the interface
Returns:
the registered implementation corresponding to the interface

hasConfiguration

public boolean hasConfiguration(java.lang.Class configurationClass)
Returns true, if there is a Configuration stored under the given configuration key class.

Throws:
java.lang.IllegalArgumentException - if the given class is null
Since:
Quasar Client 2.1

getConfiguration

public Configuration getConfiguration(java.lang.Class configurationClass)
Returns the implementation for the given interface class.

Throws:
java.lang.IllegalArgumentException - if the given class is null
java.util.NoSuchElementException - if no mapping is found for the given interface class
Since:
Quasar Client 2.1