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
ALcyPropertiesinstance that was added last, a value could still be retrieved from this composite instance when anotherALcyPropertiesalso contains a value for the removed key. - No
PropertyChangeEventevents are fired when adding a newALcyPropertiesinstance. Add all desiredALcyPropertiesinstances before working with this composite properties instance. - Properties can only be added to this composite properties instance when at least one
ALcyPropertiesinstance was added already
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProperties(ALcyProperties aProperties) Adds the specifiedALcyPropertiesinstance to this composite instance.voidclear()Clears this key-value pair list so that it contains no keys.booleancontainsKey(String aKey) Returns true if the key-value pair with the specified key exists.protected ObjectImplementation version of the get method, which retrieves the value from the underlying store.getProperties(int aIndex) Returns theALcyPropertiesat the specified index.intReturns the number ofALcyPropertiesinstances that are present in this composite preferences.keys()Returns the keys of thisTLcyProperties.protected voidImplementation version of the put method, which puts the value in the underlying store.voidRemoves the key (and its corresponding value) from this key-value pair list.voidremoveProperties(ALcyProperties aProperties) Removes the specifiedALcyPropertiesfrom this composite instance.intsize()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
ALcyPropertiesinstance to this composite instance.- Parameters:
aProperties- TheALcyPropertiesto add. Must not benull. May not already have been added to this composite instance.- Throws:
NullPointerException- If the specifiedALcyPropertiesisnull.IllegalArgumentException- If the specifiedALcyPropertieswas already added to this composite instance.
-
removeProperties
Removes the specified
ALcyPropertiesfrom this composite instance.- Parameters:
aProperties- TheALcyPropertiesto remove. If it was not added to this composite instance, this composite instance is unchanged.
-
getProperties
Returns the
ALcyPropertiesat the specified index.- Parameters:
aIndex- The index of theALcyPropertiesto retrieve. Must be between0andgetPropertiesCount.- Returns:
- The
ALcyPropertiesat the specified index. Nevernull. - Throws:
IndexOutOfBoundsException- If the specified index was less than0or greater than or equal togetPropertiesCount.- See Also:
-
getPropertiesCount
public int getPropertiesCount()Returns the number of
ALcyPropertiesinstances that are present in this composite preferences.- Returns:
- The number of
ALcyPropertiesinstances. Always greater than or equal to0.
-
getImpl
Description copied from class:ALcyPropertiesImplementation version of the get method, which retrieves the value from the underlying store.- Specified by:
getImplin classALcyProperties- Parameters:
aKey- The key, guaranteed to be notnull.- Returns:
- The value associated with the key, or
nullif no value is associated.
-
putImpl
Description copied from class:ALcyPropertiesImplementation version of the put method, which puts the value in the underlying store.- Specified by:
putImplin 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:ALcyPropertiesRemoves the key (and its corresponding value) from this key-value pair list. This method does nothing if the key is unknown.- Specified by:
removein classALcyProperties- Parameters:
aKey- the key to be removed
-
size
public int size()Description copied from class:ALcyPropertiesReturns the number of key-value pairs.- Specified by:
sizein classALcyProperties- Returns:
- the number of key-value pairs.
-
containsKey
Description copied from class:ALcyPropertiesReturns true if the key-value pair with the specified key exists.- Specified by:
containsKeyin classALcyProperties- Parameters:
aKey- key to look for- Returns:
- true if the key-value pair with the specified key exists.
-
keys
Description copied from class:ALcyPropertiesReturns the keys of thisTLcyProperties.- Specified by:
keysin classALcyProperties- Returns:
- the keys of this
TLcyProperties.
-
clear
public void clear()Description copied from class:ALcyPropertiesClears this key-value pair list so that it contains no keys. Calling this method could result in anull-null-nullproperty change event indicating all properties have changed, or in a separate event for all removed properties (implementation specific).- Specified by:
clearin classALcyProperties
-