com.emarsys.ecommon.prefs.config
Interface ConfigurationDeclaration

All Known Implementing Classes:
ClassConfigurationDeclaration, GenericConfigurationDeclaration

public interface ConfigurationDeclaration

A ConfigurationDeclaration holds metadata information about a Configuration like its name and ConfigurationDeclaration.DeclarationType but it also acts as a parser for the actual declaration and is able to retrieve defined fallback settings or default values.

Note that a Configuration itself is responsible to initialize its ConfigurationBackend according to the ConfigurationDeclaration during its creation, the latter only holds the declarative information about what to do, not how to accomplish this.
Thus if the ConfigurationDeclaration specifies, for instance, the type Configuration.Type.FALLBACK_DEFAULT then it's up to the Configuration to instantiate a corresponding ConfigurationBackend and the ConfigurationDeclaration only supports the the default values and fallback ISettings.

Author:
Michael "kULO" Kulovits

Nested Class Summary
static class ConfigurationDeclaration.DeclarationType
          Defines the different types of String declarations possible.
 
Method Summary
 ConfigurationBackend getDefaults()
          Returns a ConfigurationBackend that holds all default values defined in this ConfigurationDeclaration, if no such default values are defined an emtpy ConfigurationBackend will be returned.
 java.util.Map<java.lang.String,java.lang.String> getFallbacks()
          Returns the fallback ISettings defined by this ConfigurationDeclaration, if no such fallbacks are present an emtpy Map will be returned.
 java.lang.String getName()
          Returns the name of the Configuration associated with this ConfigurationDeclaration.
 java.util.Set<java.lang.String> getSettingNames()
          Returns a List of declared ISetting names.
 Configuration.Type getType()
          Returns the ConfigurationDeclaration.DeclarationType of the Configuration associated with this ConfigurationDeclaration.
 

Method Detail

getName

java.lang.String getName()
Returns the name of the Configuration associated with this ConfigurationDeclaration.

Returns:
always a valid non-null, non-emtpy String.

getType

Configuration.Type getType()
Returns the ConfigurationDeclaration.DeclarationType of the Configuration associated with this ConfigurationDeclaration.

Returns:
always a valid ConfigurationDeclaration.DeclarationType, never null.

getSettingNames

java.util.Set<java.lang.String> getSettingNames()
Returns a List of declared ISetting names.

Returns:
always a valid, possibly emtpy, List of ISetting names.

getFallbacks

java.util.Map<java.lang.String,java.lang.String> getFallbacks()
Returns the fallback ISettings defined by this ConfigurationDeclaration, if no such fallbacks are present an emtpy Map will be returned.

Returns:
always a valid Map instance, never null.

getDefaults

ConfigurationBackend getDefaults()
Returns a ConfigurationBackend that holds all default values defined in this ConfigurationDeclaration, if no such default values are defined an emtpy ConfigurationBackend will be returned.

Returns:
always a valid ConfigurationBackend instance, never null.


Copyright © 2010 emarsys AG. All Rights Reserved.