org.progeeks.meta.util
Class MapMetaObject

java.lang.Object
  extended by org.progeeks.util.beans.BeanChangeSupport
      extended by org.progeeks.meta.AbstractMetaObject
          extended by org.progeeks.meta.util.MapMetaObject
All Implemented Interfaces:
java.io.Serializable, MetaObject, StandardBean

public class MapMetaObject
extends AbstractMetaObject
implements java.io.Serializable

A meta-object implementation providing access to a java.util.Map.

Version:
$Revision: 1.27 $
Author:
Paul Speed
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.progeeks.meta.AbstractMetaObject
AbstractMetaObject.BaseListMutator
 
Field Summary
static MetaClass BASE_MAP_CLASS
           
 
Constructor Summary
MapMetaObject(java.util.Map map, MetaClass metaClass, MetaKit metaKit)
          Creates a MetaObject implementation that wraps the specified map and provides access consistent with the specified meta-class.
MapMetaObject(java.util.Map map, MetaClass metaClass, MetaKit metaKit, boolean applyDefaults)
          Creates a MetaObject implementation that wraps the specified map and provides access consistent with the specified meta-class.
MapMetaObject(TypedMap map, MetaClass superClass, MetaKit metaKit)
          Creates a MetaObject implementat that wraps the specified map and creates a meta-class using the TypedMap's property info.
MapMetaObject(TypedMap map, MetaKit metaKit)
          Creates a MetaObject implementat that wraps the specified map and creates a meta-class using the TypedMap's property info.
 
Method Summary
protected  void applyDefaults()
          Internal method to apply default values from the PropertyInfo definitions.
 boolean equals(java.lang.Object obj)
           
protected  java.util.Map getMap()
           
protected  java.lang.Object getPropertyValue(java.lang.String name)
          Retrieves the property from the internal map.
 int hashCode()
           
protected  java.lang.Object setPropertyValue(java.lang.String name, java.lang.Object value)
          Stores the property in the internal map.
 java.lang.String toString()
           
protected  java.lang.Object wrapPropertyValue(java.lang.String name, PropertyType type, java.lang.Object value)
          Overridden to wrap any nested TypedMaps.
 
Methods inherited from class org.progeeks.meta.AbstractMetaObject
cacheWrapper, createListMutator, createPropertyMutator, getCachedWrapper, getMetaClass, getMetaKit, getProperty, getPropertyMutator, readMetaClass, readResolve, release, setMetaClass, setMetaKit, setProperty, unwrapPropertyValue, writeMetaClass, writeReplace
 
Methods inherited from class org.progeeks.util.beans.BeanChangeSupport
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.progeeks.meta.MetaObject
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

BASE_MAP_CLASS

public static final MetaClass BASE_MAP_CLASS
Constructor Detail

MapMetaObject

public MapMetaObject(TypedMap map,
                     MetaClass superClass,
                     MetaKit metaKit)
Creates a MetaObject implementat that wraps the specified map and creates a meta-class using the TypedMap's property info. The created meta-class will use the specified superClass as its superClass.


MapMetaObject

public MapMetaObject(java.util.Map map,
                     MetaClass metaClass,
                     MetaKit metaKit)
Creates a MetaObject implementation that wraps the specified map and provides access consistent with the specified meta-class. Any default values in the specified meta-class will be applied to the resulting meta-object.


MapMetaObject

public MapMetaObject(java.util.Map map,
                     MetaClass metaClass,
                     MetaKit metaKit,
                     boolean applyDefaults)
Creates a MetaObject implementation that wraps the specified map and provides access consistent with the specified meta-class.


MapMetaObject

public MapMetaObject(TypedMap map,
                     MetaKit metaKit)
Creates a MetaObject implementat that wraps the specified map and creates a meta-class using the TypedMap's property info. The generated MetaClass will have no superclass and the root class registry will be used.

Method Detail

applyDefaults

protected void applyDefaults()
Internal method to apply default values from the PropertyInfo definitions. This is called by the various constructors. It the property value is already set in the map then we don't reset it. If the default value of the PropertyInfo is null then we also don't set it... because the property in the map is already null anyway. Note: we may actually want to expose this in the MetaKit interface.


getMap

protected java.util.Map getMap()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setPropertyValue

protected java.lang.Object setPropertyValue(java.lang.String name,
                                            java.lang.Object value)
Stores the property in the internal map.

Specified by:
setPropertyValue in class AbstractMetaObject

getPropertyValue

protected java.lang.Object getPropertyValue(java.lang.String name)
Retrieves the property from the internal map.

Specified by:
getPropertyValue in class AbstractMetaObject

wrapPropertyValue

protected java.lang.Object wrapPropertyValue(java.lang.String name,
                                             PropertyType type,
                                             java.lang.Object value)
Overridden to wrap any nested TypedMaps.

Overrides:
wrapPropertyValue in class AbstractMetaObject

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2003 Paul Speed. All Rights Reserved.