|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deduced.AbstractPropertyCollection<K,V> org.deduced.PropertyMap<K,V>
K
- the type of key in the mapV
- the type of value in the mappublic class PropertyMap<K,V>
A property map represents a property collection in which properties may be added, changed and removed. The keys aren't specified, so it's up to the user of the property map to specify the keys he wants to use in this map.
Some specialization exists where the object instance ID is used as a fixed key so that there is no need to specify the key. (IdPropertyMap and PropertyList)
Nested Class Summary | |
---|---|
protected class |
PropertyMap.PropertyIterator
Title: PropertyIterator |
protected class |
PropertyMap.ValueIterator
Title: ValueIterator |
Nested classes/interfaces inherited from class org.deduced.AbstractPropertyCollection |
---|
AbstractPropertyCollection.CollectionToDeleteMonitor |
Field Summary | |
---|---|
private PropertyCollection<?,?> |
fixedInstance
the instance hooked to all the values in this map |
static PropertyCollectionTypeHolder |
PROPERTY_MAP_TYPE
property map type |
private java.util.Map<K,Property<V>> |
propertyMap
the array Map containing all the properties |
private static long |
serialVersionUID
the serial version |
Fields inherited from class org.deduced.AbstractPropertyCollection |
---|
CHECK_DELETE_MODE_AUTOMATIC, CHECK_DELETE_MODE_MANUAL, COLLECTION_TO_DELETE |
Fields inherited from interface org.deduced.PropertyCollection |
---|
PROPERTY_COLLECTION_TYPE |
Constructor Summary | |
---|---|
|
PropertyMap()
constructor for the property map |
protected |
PropertyMap(java.util.Map<K,Property<V>> mapToUse,
PropertyCollection<?,?> setFixedInstance)
constructor for the property map |
|
PropertyMap(PropertyCollection<?,?> setFixedInstance)
constructor for the property map |
Method Summary | |
---|---|
K |
addProperty(K key,
PropertyCollection<?,?> instance,
V value)
(non-Javadoc) |
boolean |
areKeysAssignedAutomatically()
(non-Javadoc) |
java.util.Set<K> |
asKeySet()
(non-Javadoc) |
protected void |
cleanNewlyClonedValue(AbstractPropertyCollection<K,V> newClone)
(non-JSDoc) |
java.lang.Object |
clone()
(non-Javadoc) |
boolean |
containsKey(java.lang.Object key)
(non-Javadoc) |
PropertyCollection<?,?> |
getFixedInstance()
(non-Javadoc) |
Property<V> |
getProperty(java.lang.Object propertyKey)
(non-Javadoc) |
V |
getPropertyValue(java.lang.Object key)
(non-Javadoc) |
protected void |
handleRemovedProperty(java.lang.Object propertyKey,
Property<V> removedProperty)
handleRemovedProperty |
protected K |
internalAddProperty(K propertyKey,
Property<V> resultAdd)
internalAddProperty internally add a property to the map. |
protected boolean |
internalIsSetValueParentNecessary(V newValue,
boolean isReference)
check if set value parent is necessary |
protected Property<V> |
internalRemoveProperty(java.lang.Object propertyKey)
Internal method used to remove a property from the map. |
protected void |
internalSetValueParentIfNecessary(K propertyKey,
V newValue,
boolean isReference)
internal Set the parent on the new value If Necessary |
boolean |
isFixedInstanceReference()
is Fixed Instance Reference |
java.util.Iterator<Property<V>> |
iterator()
(non-Javadoc) |
java.util.Iterator<V> |
iteratorByValue()
(non-Javadoc) |
protected void |
putPropertyInMap(K propertyKey,
Property<V> resultAdd)
put Property In Map |
Property<V> |
removeProperty(java.lang.Object propertyKey)
(non-Javadoc) |
Property<V> |
removePropertyInstance(V instance)
(non-Javadoc) |
Property<V> |
removePropertyValue(V value)
(non-Javadoc) |
protected void |
resetRemovedPropertyParent(PropertyCollection<?,?> instance,
V value)
reset Removed Property Parent |
void |
setFixedInstance(PropertyCollection<?,?> instance)
(non-JSDoc) |
V |
setProperty(K propertyKey,
V value)
(non-Javadoc) |
int |
size()
(non-Javadoc) |
PropertyCollection<?,?> |
type()
(non-Javadoc) |
protected void |
validateCollectionParentBeforeAddition(PropertyCollection<?,?> newCollection)
validate Collection Parent Before Addition |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final PropertyCollectionTypeHolder PROPERTY_MAP_TYPE
private java.util.Map<K,Property<V>> propertyMap
private PropertyCollection<?,?> fixedInstance
Constructor Detail |
---|
public PropertyMap()
public PropertyMap(PropertyCollection<?,?> setFixedInstance)
setFixedInstance
- instance of objects contained by this mapprotected PropertyMap(java.util.Map<K,Property<V>> mapToUse, PropertyCollection<?,?> setFixedInstance)
mapToUse
- the map implementation to use while storing propertiessetFixedInstance
- the fixed instance used by this mapMethod Detail |
---|
public void setFixedInstance(PropertyCollection<?,?> instance)
setFixedInstance
in interface PropertyCollection<K,V>
setFixedInstance
in class AbstractPropertyCollection<K,V>
instance
- the new fixed instancePropertyCollection.setFixedInstance(org.deduced.PropertyCollection)
public Property<V> getProperty(java.lang.Object propertyKey)
propertyKey
- the property key
PropertyCollection.getProperty(java.lang.Object)
public Property<V> removeProperty(java.lang.Object propertyKey)
propertyKey
- the key of the property
PropertyCollection.removeProperty(java.lang.Object)
protected Property<V> internalRemoveProperty(java.lang.Object propertyKey)
propertyKey
- the property key to remove
protected void handleRemovedProperty(java.lang.Object propertyKey, Property<V> removedProperty)
propertyKey
- the removed property keyremovedProperty
- the removed propertyprotected void resetRemovedPropertyParent(PropertyCollection<?,?> instance, V value)
instance
- property instancevalue
- property valuepublic V setProperty(K propertyKey, V value)
propertyKey
- the key of the propertyvalue
- the new value of the property. If the property is a
collection that is not by reference, this method requires that
the passed collection has a parent set to null since it will
reset the parent.
PropertyCollection.setProperty(java.lang.Object,
java.lang.Object)
public boolean isFixedInstanceReference()
protected K internalAddProperty(K propertyKey, Property<V> resultAdd)
propertyKey
- the key of the added propertyresultAdd
- the property to add to the map
protected void internalSetValueParentIfNecessary(K propertyKey, V newValue, boolean isReference)
propertyKey
- the property key of the new valuenewValue
- the new valueisReference
- is the new value a referenceprotected void validateCollectionParentBeforeAddition(PropertyCollection<?,?> newCollection)
newCollection
- the collection to addprotected boolean internalIsSetValueParentNecessary(V newValue, boolean isReference)
newValue
- the new valueisReference
- is the new value a reference
protected void putPropertyInMap(K propertyKey, Property<V> resultAdd)
propertyKey
- the key to addresultAdd
- the property to addpublic int size()
PropertyCollection.size()
public java.lang.Object clone()
clone
in interface PropertyCollection<K,V>
clone
in class AbstractPropertyCollection<K,V>
Object.clone()
protected void cleanNewlyClonedValue(AbstractPropertyCollection<K,V> newClone)
cleanNewlyClonedValue
in class AbstractPropertyCollection<K,V>
newClone
- the newly created clone of the current collectionAbstractPropertyCollection.cleanNewlyClonedValue(org.deduced.AbstractPropertyCollection)
public java.util.Iterator<Property<V>> iterator()
PropertyCollection.iterator()
public V getPropertyValue(java.lang.Object key)
key
- the property key
PropertyCollection.getPropertyValue(java.lang.Object)
public java.util.Iterator<V> iteratorByValue()
PropertyCollection.iteratorByValue()
public K addProperty(K key, PropertyCollection<?,?> instance, V value)
key
- the key of the property. Some collections assign keys
automatically, for those collections, a null value is
expected. If the key is specified when they are assigned
automatically, an IllegalArgumentException will be throwninstance
- the property instance to add. Most collections assign the
instance automatically, for those collections, the instance
can either be null or be the same as the instance that is
automatically assigned, otherwise an error will be thrownvalue
- the property value. If the value is a property collection,
then the collection is expected to have a null parent if the
instance is owned (not by reference), otherwise an
IllegalArgumentException will be thrown
PropertyCollection.addProperty(java.lang.Object,
org.deduced.PropertyCollection, java.lang.Object)
public PropertyCollection<?,?> getFixedInstance()
AbstractPropertyCollection
getFixedInstance
in interface PropertyCollection<K,V>
getFixedInstance
in class AbstractPropertyCollection<K,V>
PropertyCollection.getFixedInstance()
public boolean containsKey(java.lang.Object key)
key
- the property key
PropertyCollection.containsKey(java.lang.Object)
public java.util.Set<K> asKeySet()
PropertyCollection.asKeySet()
public PropertyCollection<?,?> type()
PropertyCollection.type()
public Property<V> removePropertyInstance(V instance)
instance
- the object to remove
PropertyCollection.removePropertyInstance(java.lang.Object)
public Property<V> removePropertyValue(V value)
value
- the value to remove
PropertyCollection.removePropertyValue(java.lang.Object)
public boolean areKeysAssignedAutomatically()
PropertyCollection.areKeysAssignedAutomatically()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |