com.emarsys.ecommon.prefs.config.backend
Class ModeSettingConfigurationBackend

java.lang.Object
  extended by com.emarsys.ecommon.prefs.config.backend.ModeSettingConfigurationBackend
All Implemented Interfaces:
ConfigurationBackend

public class ModeSettingConfigurationBackend
extends java.lang.Object
implements ConfigurationBackend

A proxy to arbitrary ConfigurationBackends that is associated with a specific SettingMode. Every ISetting retrieved from the backend will get its mode set correspondingly.

Author:
Michael "kULO" Kulovits

Field Summary
protected  ConfigurationBackend backend
           
protected  SettingMode mode
           
 
Constructor Summary
ModeSettingConfigurationBackend(ConfigurationBackend backend, SettingMode mode)
           
 
Method Summary
 ISetting get(java.lang.String name)
          Every ISetting retrieved from this ConfigurationBackend will have its SettingMode set to mode.
 java.util.List<ISetting> getSettings()
          Every ISetting retrieved from this ConfigurationBackend will have its SettingMode set to mode.
 void set(ISetting setting)
          Sets the passed setting which must not be null in this configuration backend, if a setting with the given name is already present it will be overridden.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mode

protected SettingMode mode

backend

protected ConfigurationBackend backend
Constructor Detail

ModeSettingConfigurationBackend

public ModeSettingConfigurationBackend(ConfigurationBackend backend,
                                       SettingMode mode)
Method Detail

get

public ISetting get(java.lang.String name)
             throws java.lang.IllegalArgumentException
Every ISetting retrieved from this ConfigurationBackend will have its SettingMode set to mode.

Specified by:
get in interface ConfigurationBackend
Returns:
the ISetting with the passed name or null if not present.
Throws:
java.lang.IllegalArgumentException - - if the passed name is null.
See Also:
com.emarsys.core.setting.backend.ConfigurationBackend#get(java.lang.String)

getSettings

public java.util.List<ISetting> getSettings()
Every ISetting retrieved from this ConfigurationBackend will have its SettingMode set to mode.

Specified by:
getSettings in interface ConfigurationBackend
Returns:
always a valid List of ISettings, never null.
See Also:
com.emarsys.core.setting.backend.ConfigurationBackend#getSettings()

set

public void set(ISetting setting)
         throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurationBackend
Sets the passed setting which must not be null in this configuration backend, if a setting with the given name is already present it will be overridden. The next call to ConfigurationBackend.get(String) with the passed setting's name will return the passed setting.

Specified by:
set in interface ConfigurationBackend
Throws:
java.lang.IllegalArgumentException - - if the passed setting, its name or value is null.
See Also:
com.emarsys.core.setting.backend.ConfigurationBackend#set(ISetting)


Copyright © 2010 emarsys AG. All Rights Reserved.