public class TLcyCompositeProperties extends ALcyProperties
Composite implementation of ALcyProperties
.
When retrieving a property, this composite preferences will search the added
ALcyProperties
instances from last to first. This means that in case a certain
property is present in more than one ALcyProperties
instance, the value of the
ALcyProperties
that was added last will be returned.
When putting or removing a property, this composite preferences will insert or remove the
property in the ALcyProperties
instance that was added last.
There are some limitations to take into account:
ALcyProperties
instance that was added last, a value could still be retrieved from
this composite instance when another ALcyProperties
also contains a value for the
removed key.PropertyChangeEvent
events are fired when adding a new
ALcyProperties
instance. Add all desired ALcyProperties
instances
before working with this composite properties instance.ALcyProperties
instance was added alreadyConstructor and Description |
---|
TLcyCompositeProperties() |
Modifier and Type | Method and Description |
---|---|
void |
addProperties(ALcyProperties aProperties)
Adds the specified
ALcyProperties instance to this composite instance. |
void |
clear()
Clears this key-value pair list so that it contains no keys.
|
boolean |
containsKey(java.lang.String aKey)
Returns true if the key-value pair with the specified key exists.
|
protected java.lang.Object |
getImpl(java.lang.String aKey)
Implementation version of the get method, which retrieves the value from the underlying store.
|
ALcyProperties |
getProperties(int aIndex)
Returns the
ALcyProperties at the specified index. |
int |
getPropertiesCount()
Returns the number of
ALcyProperties instances that are present in this
composite preferences. |
java.util.Iterator<java.lang.String> |
keys()
Returns the keys of this
TLcyProperties . |
protected void |
putImpl(java.lang.String aKey,
java.lang.Object aNewValue)
Implementation version of the put method, which puts the value in the underlying store.
|
void |
remove(java.lang.String aKey)
Removes the key (and its corresponding value) from this key-value pair list.
|
void |
removeProperties(ALcyProperties aProperties)
Removes the specified
ALcyProperties from this composite instance. |
int |
size()
Returns the number of key-value pairs.
|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, get, get, getBoolean, getBooleanArray, getColor, getColorArray, getDouble, getDoubleArray, getFloat, getFloatArray, getInt, getIntArray, getLong, getLongArray, getPropertyChangeListeners, getPropertyChangeListeners, getString, getStringArray, isEmpty, put, put, putAll, putAll, putBoolean, putBooleanArray, putColor, putColorArray, putDouble, putDoubleArray, putFloat, putFloatArray, putInt, putIntArray, putLong, putLongArray, putString, putStringArray, removePropertyChangeListener, removePropertyChangeListener, subset, synchronizeSFCT, unmodifiable
public void addProperties(ALcyProperties aProperties)
Adds the specified ALcyProperties
instance to this composite instance.
aProperties
- The ALcyProperties
to add. Must not be null
. May
not already have been added to this composite instance.java.lang.NullPointerException
- If the specified ALcyProperties
is
null
.java.lang.IllegalArgumentException
- If the specified ALcyProperties
was already added
to this composite instance.public void removeProperties(ALcyProperties aProperties)
Removes the specified ALcyProperties
from this composite instance.
aProperties
- The ALcyProperties
to remove. If it was not added to this
composite instance, this composite instance is unchanged.public ALcyProperties getProperties(int aIndex)
Returns the ALcyProperties
at the specified index.
aIndex
- The index of the ALcyProperties
to retrieve. Must be between
0
and getPropertiesCount
.ALcyProperties
at the specified index. Never null
.java.lang.IndexOutOfBoundsException
- If the specified index was less than 0
or
greater than or equal to getPropertiesCount
.getPropertiesCount()
public int getPropertiesCount()
Returns the number of ALcyProperties
instances that are present in this
composite preferences.
ALcyProperties
instances. Always greater than or equal to
0
.protected java.lang.Object getImpl(java.lang.String aKey)
ALcyProperties
getImpl
in class ALcyProperties
aKey
- The key, guaranteed to be not null
.null
if no value is associated.protected void putImpl(java.lang.String aKey, java.lang.Object aNewValue)
ALcyProperties
putImpl
in class ALcyProperties
aKey
- The key, guaranteed to be not null
.aNewValue
- The value to associate to the key, guaranteed to be not null
.public void remove(java.lang.String aKey)
ALcyProperties
remove
in class ALcyProperties
aKey
- the key to be removedpublic int size()
ALcyProperties
size
in class ALcyProperties
public boolean containsKey(java.lang.String aKey)
ALcyProperties
containsKey
in class ALcyProperties
aKey
- key to look forpublic java.util.Iterator<java.lang.String> keys()
ALcyProperties
TLcyProperties
.keys
in class ALcyProperties
TLcyProperties
.public void clear()
ALcyProperties
null-null-null
property change event indicating all properties have changed,
or in a separate event for all removed properties (implementation specific).clear
in class ALcyProperties