|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<java.lang.Object,java.lang.Object>
java.util.Properties
com.emarsys.ecommon.prefs.config.backend.PropertiesConfigurationBackend
com.emarsys.ecommon.prefs.config.backend.SnapshotPropertiesConfigurationBackend
public class SnapshotPropertiesConfigurationBackend
An immutable version of PropertiesConfigurationBackend
.
This class is useful if you want to pass an immutable snapshot of a
ConfigurationBackend
to some client.
An ImmutableObjectException
will be thrown on every method
that would change the underlying Properties
object.
Field Summary |
---|
Fields inherited from class com.emarsys.ecommon.prefs.config.backend.PropertiesConfigurationBackend |
---|
props |
Fields inherited from class java.util.Properties |
---|
defaults |
Constructor Summary | |
---|---|
protected |
SnapshotPropertiesConfigurationBackend(java.util.Properties props)
|
Method Summary | |
---|---|
void |
clear()
|
static PropertiesConfigurationBackend |
copy(ConfigurationBackend backend)
The same as snapshoot(ConfigurationBackend) . |
void |
load(java.io.InputStream inStream)
|
void |
loadFromXML(java.io.InputStream in)
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> t)
|
java.lang.Object |
remove(java.lang.Object key)
|
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. |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
|
static PropertiesConfigurationBackend |
snapshoot(ConfigurationBackend backend)
Creates a new PropertiesConfigurationBackend
instance that contains all ISetting s from the
passed backend. |
static PropertiesConfigurationBackend |
wrap(java.util.Properties props)
Creates a new PropertiesConfigurationBackend that uses
the passed Properties to store its ISetting 's
names and values. |
Methods inherited from class com.emarsys.ecommon.prefs.config.backend.PropertiesConfigurationBackend |
---|
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, get, getProperty, getProperty, getSettings, hashCode, isEmpty, keys, keySet, list, list, propertyNames, save, size, store, storeToXML, storeToXML, toString, values |
Methods inherited from class java.util.Properties |
---|
load, store, stringPropertyNames |
Methods inherited from class java.util.Hashtable |
---|
rehash |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected SnapshotPropertiesConfigurationBackend(java.util.Properties props) throws java.lang.IllegalArgumentException
props
-
java.lang.IllegalArgumentException
Method Detail |
---|
public static PropertiesConfigurationBackend wrap(java.util.Properties props)
Creates a new PropertiesConfigurationBackend
that uses
the passed Properties
to store its ISetting
's
names and values.
The wrap factory method is just a more verbose wrapped to
SnapshotPropertiesConfigurationBackend(Properties)
.
props
- - the Properties
to be wrapped into a
ConfigurationBackend
.
PropertiesConfigurationBackend
instance,
never null
.SnapshotPropertiesConfigurationBackend(Properties)
public static PropertiesConfigurationBackend copy(ConfigurationBackend backend)
snapshoot(ConfigurationBackend)
.
Has been redefined in order to override
PropertiesConfigurationBackend.copy(ConfigurationBackend)
and prevent misunderstandings.
backend
-
PropertiesConfigurationBackend
instance,
never null
.public static PropertiesConfigurationBackend snapshoot(ConfigurationBackend backend)
Creates a new PropertiesConfigurationBackend
instance that contains all ISetting
s from the
passed backend.
Note that this factory method retrieves the ISetting
s
from the passed backend by calling
ConfigurationBackend.getSettings()
which will be copied into the newly created
PropertiesConfigurationBackend
.
Note that this described semantic of
copy(ConfigurationBackend)
differs from the one in
wrap(Properties)
.
backend
- - the ConfigurationBackend
whose
ISetting
s should be copied;
must not be null
.
PropertiesConfigurationBackend
instance,
never null
.PropertiesConfigurationBackend.copy(ConfigurationBackend)
,
wrap(Properties)
public void set(ISetting setting) throws java.lang.IllegalArgumentException
ConfigurationBackend
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.
set
in interface ConfigurationBackend
set
in class PropertiesConfigurationBackend
java.lang.IllegalArgumentException
- - if the passed setting,
its name or value is null
.PropertiesConfigurationBackend.set(com.emarsys.ecommon.prefs.config.ISetting)
public void clear()
clear
in interface java.util.Map<java.lang.Object,java.lang.Object>
clear
in class PropertiesConfigurationBackend
PropertiesConfigurationBackend.clear()
public void load(java.io.InputStream inStream) throws java.io.IOException
load
in class PropertiesConfigurationBackend
java.io.IOException
PropertiesConfigurationBackend.load(java.io.InputStream)
public void loadFromXML(java.io.InputStream in) throws java.io.IOException, java.util.InvalidPropertiesFormatException
loadFromXML
in class PropertiesConfigurationBackend
java.io.IOException
java.util.InvalidPropertiesFormatException
PropertiesConfigurationBackend.loadFromXML(java.io.InputStream)
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map<java.lang.Object,java.lang.Object>
put
in class PropertiesConfigurationBackend
PropertiesConfigurationBackend.put(java.lang.Object, java.lang.Object)
public void putAll(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> t)
putAll
in interface java.util.Map<java.lang.Object,java.lang.Object>
putAll
in class PropertiesConfigurationBackend
PropertiesConfigurationBackend.putAll(java.util.Map)
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.Object,java.lang.Object>
remove
in class PropertiesConfigurationBackend
PropertiesConfigurationBackend.remove(java.lang.Object)
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
setProperty
in class PropertiesConfigurationBackend
PropertiesConfigurationBackend.setProperty(java.lang.String, java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |