public class PropertyMapImpl extends java.lang.Object implements PropertyMap
Constructor and Description |
---|
PropertyMapImpl(PropertyMapGroup propertyGroup) |
PropertyMapImpl(PropertyMapGroup propertyGroup,
PropertyMapImpl superObject) |
PropertyMapImpl(PropertyMapGroup propertyGroup,
PropertyMapImpl parent,
PropertyMapProperty property) |
PropertyMapImpl(PropertyMapImpl inheritFrom) |
PropertyMapImpl(PropertyMapImpl parent,
PropertyMapProperty property) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(PropertyMapListener listener)
Adds a listener that listens for value changes in this PropertyMap.
|
void |
addPropertyChangeListener(Property property,
PropertyChangeListener listener)
Adds a property listener that listens for value changes for a specific property.
|
void |
addSuperMap(PropertyMap superMap)
Adds a super map to this map.
|
void |
addTreeListener(PropertyMapTreeListener listener)
Adds a tree listener that listens for value changes in this PropertyMap or any child maps.
|
void |
clear(boolean recursive)
Removes all property values in this property map.
|
PropertyMap |
copy(boolean copySuperMaps,
boolean recursive)
Creates a copy of this map.
|
java.lang.Object |
createRelativeRef(Property fromProperty,
PropertyMap toObject,
Property toProperty)
Creates a relative reference from one property value to another property value.
|
void |
dump() |
void |
dump(Printer printer,
java.util.Set printed) |
void |
dumpSuperMaps(Printer printer) |
protected void |
firePropertyTreeValuesChanged(java.util.Map changes) |
void |
firePropertyValueChanged(Property property,
ValueChange change) |
PropertyMap |
getChildMap(PropertyMapProperty property) |
PropertyMapImpl |
getChildMapImpl(PropertyMapProperty property) |
ConstChangeNotifyMap |
getMap() |
PropertyMapImpl |
getParent() |
PropertyMapProperty |
getProperty() |
PropertyMapGroup |
getPropertyGroup() |
PropertyMap |
getSuperMap()
Returns the most recently added super map.
|
int |
getSuperMapCount() |
PropertyValue |
getValue(Property property) |
PropertyValue |
getValueWithDefault(Property property) |
boolean |
isEmpty(boolean recursive)
Returns true if this property map doesn't contain any property values.
|
void |
read(java.io.ObjectInputStream in)
Reads property values from a stream and sets them in this map.
|
void |
removeListener(PropertyMapListener listener)
Removes a listener which was previously added with
PropertyMap.addListener(PropertyMapListener) . |
void |
removePropertyChangeListener(Property property,
PropertyChangeListener listener)
Removes a previously added property listener.
|
PropertyMap |
removeSuperMap()
Removes the most recently added super map.
|
boolean |
removeSuperMap(PropertyMap superMap)
Removes a super map that has previously been added using
PropertyMap.addSuperMap(PropertyMap) . |
void |
removeTreeListener(PropertyMapTreeListener listener)
Removes a previously added tree listener.
|
java.lang.Object |
removeValue(Property property)
Removes a property value.
|
boolean |
replaceSuperMap(PropertyMap oldSuperMap,
PropertyMap newSuperMap)
Replaces a super map that has previously been added using
PropertyMap.addSuperMap(PropertyMap) . |
PropertyValue |
setValue(Property property,
PropertyValue value) |
static void |
skip(java.io.ObjectInputStream in) |
boolean |
valueIsSet(Property property) |
boolean |
valuesEqualTo(PropertyMap propertyObject,
boolean recursive)
Returns true if all the values in this property map is equal to the values in the given map.
|
void |
write(java.io.ObjectOutputStream out)
Serializes the serializable values of this property map.
|
void |
write(java.io.ObjectOutputStream out,
boolean recursive)
Serializes the serializable values of this property map.
|
public PropertyMapImpl(PropertyMapGroup propertyGroup)
public PropertyMapImpl(PropertyMapImpl inheritFrom)
public PropertyMapImpl(PropertyMapGroup propertyGroup, PropertyMapImpl superObject)
public PropertyMapImpl(PropertyMapImpl parent, PropertyMapProperty property)
public PropertyMapImpl(PropertyMapGroup propertyGroup, PropertyMapImpl parent, PropertyMapProperty property)
public ConstChangeNotifyMap getMap()
public PropertyMap getSuperMap()
PropertyMap
getSuperMap
in interface PropertyMap
public java.lang.Object removeValue(Property property) throws InvalidPropertyException
PropertyMap
removeValue
in interface PropertyMap
property
- the propertyInvalidPropertyException
- if values for this property can't be stored in this property mappublic java.lang.Object createRelativeRef(Property fromProperty, PropertyMap toObject, Property toProperty)
PropertyMap
When the value of the fromProperty is read, it will return the value of the toProperty in the toMap.
Sub maps of this property map will inherit this reference relative to themselves, ie the reference in the sub map is converted to a reference relative to the sub map if possible, otherwise the reference is the same as for the super map. Here is an example:
Changes to the referenced property value will be propagated to listeners of this property.
createRelativeRef
in interface PropertyMap
fromProperty
- the property value that will hold the referencetoObject
- the property map that holds the property value that is referencedtoProperty
- the property which value is referencedpublic int getSuperMapCount()
public void addSuperMap(PropertyMap superMap)
PropertyMap
addSuperMap
in interface PropertyMap
superMap
- the super mappublic PropertyMap removeSuperMap()
PropertyMap
removeSuperMap
in interface PropertyMap
public boolean removeSuperMap(PropertyMap superMap)
PropertyMap
PropertyMap.addSuperMap(PropertyMap)
.removeSuperMap
in interface PropertyMap
superMap
- the super map to removepublic boolean replaceSuperMap(PropertyMap oldSuperMap, PropertyMap newSuperMap)
PropertyMap
PropertyMap.addSuperMap(PropertyMap)
.replaceSuperMap
in interface PropertyMap
oldSuperMap
- the super map to replacenewSuperMap
- the super map to replace it withpublic void addTreeListener(PropertyMapTreeListener listener)
PropertyMap
addTreeListener
in interface PropertyMap
listener
- the listenerpublic void removeTreeListener(PropertyMapTreeListener listener)
PropertyMap
removeTreeListener
in interface PropertyMap
listener
- the listenerpublic void addListener(PropertyMapListener listener)
PropertyMap
addListener
in interface PropertyMap
listener
- the listenerpublic void removeListener(PropertyMapListener listener)
PropertyMap
PropertyMap.addListener(PropertyMapListener)
.removeListener
in interface PropertyMap
listener
- the listenerpublic PropertyMapGroup getPropertyGroup()
public void addPropertyChangeListener(Property property, PropertyChangeListener listener)
PropertyMap
addPropertyChangeListener
in interface PropertyMap
property
- the property to listen to changes onlistener
- the listenerpublic void removePropertyChangeListener(Property property, PropertyChangeListener listener)
PropertyMap
removePropertyChangeListener
in interface PropertyMap
property
- the property which the listener listens to changes onlistener
- the listenerpublic PropertyMapImpl getParent()
public PropertyMapProperty getProperty()
public PropertyMap getChildMap(PropertyMapProperty property)
public PropertyMapImpl getChildMapImpl(PropertyMapProperty property)
public PropertyValue getValueWithDefault(Property property)
public PropertyValue getValue(Property property)
public PropertyValue setValue(Property property, PropertyValue value)
public boolean valueIsSet(Property property)
public void firePropertyValueChanged(Property property, ValueChange change)
protected void firePropertyTreeValuesChanged(java.util.Map changes)
public void dump()
public void dump(Printer printer, java.util.Set printed)
public void dumpSuperMaps(Printer printer)
public void clear(boolean recursive)
PropertyMap
clear
in interface PropertyMap
recursive
- true if child maps should be cleared recursivelypublic boolean isEmpty(boolean recursive)
PropertyMap
isEmpty
in interface PropertyMap
recursive
- true if child maps should be recursively checkedpublic void write(java.io.ObjectOutputStream out, boolean recursive) throws java.io.IOException
PropertyMap
Serializable
interface will not be written to the stream. The properties are identified using their names.write
in interface PropertyMap
out
- the stream on which to serialize this maprecursive
- true if child maps should be recursively serializedjava.io.IOException
- if there is an error in the streampublic void write(java.io.ObjectOutputStream out) throws java.io.IOException
PropertyMap
Serializes the serializable values of this property map. Values not implementing the Serializable
interface will not be written to the stream. The properties are identified using their names.
This method recursively writes all child maps.
write
in interface PropertyMap
write
in interface Writable
out
- the streamjava.io.IOException
- if there is a stream errorpublic void read(java.io.ObjectInputStream in) throws java.io.IOException
PropertyMap
read
in interface PropertyMap
read
in interface Readable
in
- the stream from which to read property valuesjava.io.IOException
- if there is an error in the streampublic static void skip(java.io.ObjectInputStream in) throws java.io.IOException
java.io.IOException
public boolean valuesEqualTo(PropertyMap propertyObject, boolean recursive)
PropertyMap
Object.equals(java.lang.Object)
.valuesEqualTo
in interface PropertyMap
propertyObject
- the map to compare values withrecursive
- true if child maps should be recursively checkedpublic PropertyMap copy(boolean copySuperMaps, boolean recursive)
PropertyMap
copy
in interface PropertyMap
copySuperMaps
- if true, copies the references to super mapsrecursive
- if true, copies all child maps as well