Joda System API

org.joda.property.impl.collection
Class AbstractMapProperty

java.lang.Object
  |
  +--org.joda.property.impl.AbstractModelElement
        |
        +--org.joda.property.impl.AbstractProperty
              |
              +--org.joda.property.impl.collection.AbstractMapProperty
All Implemented Interfaces:
InitializableProperty, java.util.Map, MapProperty, ModelElement, Property, Property.Internal, java.io.Serializable
Direct Known Subclasses:
DefaultDataMapProperty, DefaultLinkMapProperty

public abstract class AbstractMapProperty
extends AbstractProperty
implements MapProperty

Standard implementation of a map.

Author:
Stephen Colebourne
See Also:
Serialized Form

Nested Class Summary
 class AbstractMapProperty.Entry
          Inner class implementation of a Map entry suitable for adding to the map.
 
Nested classes inherited from class org.joda.property.Property
Property.Internal
 
Constructor Summary
AbstractMapProperty()
          Constructor
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
protected  java.lang.Object convertMapKeyObject(java.lang.Object object)
          Check whether the key is valid to add to the map.
protected abstract  java.lang.Object convertMapValueObject(java.lang.Object object)
          Check whether the object is valid to add to the map.
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object key)
           
 java.lang.String getContentName()
          Get the name of each of the values in the map
 java.lang.Class getContentType()
          Get the type of each of the values in the map
protected  java.util.Set getInternal()
          Get the set backing the map
 java.lang.Class getMapKeyType()
          Get the type of each of the keys in the map
 java.lang.Class getPropertyType()
          Get the type of the property.
 void initBeanCreated(PropertyInit init)
          Initialise the property after the bean is complete
 void initPropertyCreated(PropertyInit init)
          Initialise the property after the constructor
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map map)
           
 java.lang.Object remove(java.lang.Object key)
           
 void set(java.lang.Object propertyValue)
          Set the property's value as an object.
 int size()
           
 java.util.Map toMap()
          Get the map underlying the property.
 java.lang.Object toObject()
          Get the property's value as an object.
 java.util.Collection values()
           
 
Methods inherited from class org.joda.property.impl.AbstractProperty
addPropertyChangeListener, bean, checkArgumentNotNull, checkModifiable, checkValueNotNull, checkValueNotNull, cloneDeep, convertObject, createClonedProperty, data, equals, equalsValue, firePropertyChange, firePropertyChange, getPropertyName, getThis, hashCode, isModifiable, isNull, isReadOnly, populateClonedProperty, removePropertyChangeListener, setModifiable, setReadOnly, toDataString, toString
 
Methods inherited from class org.joda.property.impl.AbstractModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.joda.property.Property
addPropertyChangeListener, bean, equals, equalsValue, firePropertyChange, getPropertyName, hashCode, isModifiable, isNull, isReadOnly, removePropertyChangeListener, setModifiable, setReadOnly, toString
 
Methods inherited from interface org.joda.property.ModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

AbstractMapProperty

public AbstractMapProperty()
Constructor

Method Detail

initPropertyCreated

public void initPropertyCreated(PropertyInit init)
Initialise the property after the constructor

Specified by:
initPropertyCreated in interface InitializableProperty
Overrides:
initPropertyCreated in class AbstractProperty

initBeanCreated

public void initBeanCreated(PropertyInit init)
Initialise the property after the bean is complete

Specified by:
initBeanCreated in interface InitializableProperty
Overrides:
initBeanCreated in class AbstractProperty

getPropertyType

public java.lang.Class getPropertyType()
Get the type of the property. A method String getFoo() has a property type of String.class.

Specified by:
getPropertyType in interface Property
Returns:
the property type

getInternal

protected java.util.Set getInternal()
Get the set backing the map


convertMapKeyObject

protected java.lang.Object convertMapKeyObject(java.lang.Object object)
Check whether the key is valid to add to the map. This checks using the map key type.

Throws:
IllegalArgumentPropertyException - if the argument is unacceptable for adding to the map

convertMapValueObject

protected abstract java.lang.Object convertMapValueObject(java.lang.Object object)
Check whether the object is valid to add to the map. This checks using the map value type.

Throws:
IllegalArgumentPropertyException - if the argument is unacceptable for adding to the map

getContentName

public java.lang.String getContentName()
Get the name of each of the values in the map

Specified by:
getContentName in interface Property
Overrides:
getContentName in class AbstractProperty
Returns:
the name of the list elements

getContentType

public java.lang.Class getContentType()
Get the type of each of the values in the map

Specified by:
getContentType in interface Property
Overrides:
getContentType in class AbstractProperty
Returns:
the type of the objects in the map

getMapKeyType

public java.lang.Class getMapKeyType()
Get the type of each of the keys in the map

Specified by:
getMapKeyType in interface MapProperty
Returns:
the type of the keys in the map

toObject

public java.lang.Object toObject()
Description copied from interface: Property
Get the property's value as an object. The object type will be appropriate for the type of property. The object will either be immutable or a clone of the real object.

This method has strong semantics such that where a and b are properties of the same type, it must be true that:
b.set( a.toObject() ); a.equals(b);
In other words, the object contains all the data necessary to recreate the property's value.

Specified by:
toObject in interface Property
Specified by:
toObject in class AbstractProperty
Returns:
an Object representing the property's value
See Also:
Property.toObject()

toMap

public java.util.Map toMap()
Description copied from interface: MapProperty
Get the map underlying the property.

Specified by:
toMap in interface MapProperty
Returns:
the map (a copy of the data)
See Also:
MapProperty.toMap()

set

public void set(java.lang.Object propertyValue)
Description copied from interface: Property
Set the property's value as an object. The object type should be appropriate for the type of property. If necessary, the object will be cloned before it is stored internally. Implementations will recognise as many types of object passed in as possible. Null should always be accepted, primitive types will be reset back to zero/false.

If a String is passed in, it can be parsed in various ways. If the results of toDataString() are passed in, it must reconstitute the original value.

Specified by:
set in interface Property
Specified by:
set in class AbstractProperty
Parameters:
propertyValue - an Object to set the property's value to
See Also:
Property.set(Object)

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map
See Also:
Map.get(Object)

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map
See Also:
Map.put(Object, Object)

putAll

public void putAll(java.util.Map map)
Specified by:
putAll in interface java.util.Map
See Also:
Map.putAll(Map)

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map
See Also:
Map.remove(Object)

clear

public void clear()
Specified by:
clear in interface java.util.Map
See Also:
Map.clear()

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map
See Also:
Map.containsKey(Object)

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map
See Also:
Map.containsValue(Object)

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
See Also:
Map.entrySet()

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map
See Also:
Map.keySet()

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map
See Also:
Map.values()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map
See Also:
Map.isEmpty()

size

public int size()
Specified by:
size in interface java.util.Map
See Also:
Map.size()

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.