Class TLcyCompositeProperties
- All Implemented Interfaces:
ILcdPropertyChangeSource
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:
- Since removing a property from this composite properties instance only affects the
ALcyProperties
instance that was added last, a value could still be retrieved from this composite instance when anotherALcyProperties
also contains a value for the removed key. - No
PropertyChangeEvent
events are fired when adding a newALcyProperties
instance. Add all desiredALcyProperties
instances before working with this composite properties instance. - Properties can only be added to this composite properties instance when at least one
ALcyProperties
instance was added already
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addProperties
(ALcyProperties aProperties) Adds the specifiedALcyProperties
instance to this composite instance.void
clear()
Clears this key-value pair list so that it contains no keys.boolean
containsKey
(String aKey) Returns true if the key-value pair with the specified key exists.protected Object
Implementation version of the get method, which retrieves the value from the underlying store.getProperties
(int aIndex) Returns theALcyProperties
at the specified index.int
Returns the number ofALcyProperties
instances that are present in this composite preferences.keys()
Returns the keys of thisTLcyProperties
.protected void
Implementation version of the put method, which puts the value in the underlying store.void
Removes the key (and its corresponding value) from this key-value pair list.void
removeProperties
(ALcyProperties aProperties) Removes the specifiedALcyProperties
from this composite instance.int
size()
Returns the number of key-value pairs.Methods inherited from class com.luciad.lucy.util.properties.ALcyProperties
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
-
Constructor Details
-
TLcyCompositeProperties
public TLcyCompositeProperties()
-
-
Method Details
-
addProperties
Adds the specified
ALcyProperties
instance to this composite instance.- Parameters:
aProperties
- TheALcyProperties
to add. Must not benull
. May not already have been added to this composite instance.- Throws:
NullPointerException
- If the specifiedALcyProperties
isnull
.IllegalArgumentException
- If the specifiedALcyProperties
was already added to this composite instance.
-
removeProperties
Removes the specified
ALcyProperties
from this composite instance.- Parameters:
aProperties
- TheALcyProperties
to remove. If it was not added to this composite instance, this composite instance is unchanged.
-
getProperties
Returns the
ALcyProperties
at the specified index.- Parameters:
aIndex
- The index of theALcyProperties
to retrieve. Must be between0
andgetPropertiesCount
.- Returns:
- The
ALcyProperties
at the specified index. Nevernull
. - Throws:
IndexOutOfBoundsException
- If the specified index was less than0
or greater than or equal togetPropertiesCount
.- See Also:
-
getPropertiesCount
public int getPropertiesCount()Returns the number of
ALcyProperties
instances that are present in this composite preferences.- Returns:
- The number of
ALcyProperties
instances. Always greater than or equal to0
.
-
getImpl
Description copied from class:ALcyProperties
Implementation version of the get method, which retrieves the value from the underlying store.- Specified by:
getImpl
in classALcyProperties
- Parameters:
aKey
- The key, guaranteed to be notnull
.- Returns:
- The value associated with the key, or
null
if no value is associated.
-
putImpl
Description copied from class:ALcyProperties
Implementation version of the put method, which puts the value in the underlying store.- Specified by:
putImpl
in classALcyProperties
- Parameters:
aKey
- The key, guaranteed to be notnull
.aNewValue
- The value to associate to the key, guaranteed to be notnull
.
-
remove
Description copied from class:ALcyProperties
Removes the key (and its corresponding value) from this key-value pair list. This method does nothing if the key is unknown.- Specified by:
remove
in classALcyProperties
- Parameters:
aKey
- the key to be removed
-
size
public int size()Description copied from class:ALcyProperties
Returns the number of key-value pairs.- Specified by:
size
in classALcyProperties
- Returns:
- the number of key-value pairs.
-
containsKey
Description copied from class:ALcyProperties
Returns true if the key-value pair with the specified key exists.- Specified by:
containsKey
in classALcyProperties
- Parameters:
aKey
- key to look for- Returns:
- true if the key-value pair with the specified key exists.
-
keys
Description copied from class:ALcyProperties
Returns the keys of thisTLcyProperties
.- Specified by:
keys
in classALcyProperties
- Returns:
- the keys of this
TLcyProperties
.
-
clear
public void clear()Description copied from class:ALcyProperties
Clears this key-value pair list so that it contains no keys. Calling this method could result in anull-null-null
property change event indicating all properties have changed, or in a separate event for all removed properties (implementation specific).- Specified by:
clear
in classALcyProperties
-