org.progeeks.meta.util
Class MapMetaKit

java.lang.Object
  extended by org.progeeks.meta.util.MapMetaKit
All Implemented Interfaces:
java.io.Serializable, MetaKit

public class MapMetaKit
extends java.lang.Object
implements MetaKit, java.io.Serializable

MetaKit implementation to directly support MapMetaObjects. all meta-objects returned are MapMetaObjects.

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

Field Summary
static MapMetaKit DEFAULT_KIT
           
 
Constructor Summary
MapMetaKit(MetaKit delegate)
          Creates a map meta-kit that will delegate to the specified MetaKit when it determines that it can't handle a given object on its own.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Pretend to be equals in this direction with any meta-kit that we delegate to.
 MetaKit getDelegateMetaKit()
          Returns the meta-kit that this kit will delegate to when dealing with non-map objects.
 java.lang.Object getInternalObject(MetaObject object)
          Returns the internal object representation for the specified meta-object if one exists.
 MetaClass getMetaClassForObject(java.lang.Object object)
          Returns the appropriate meta-class for the specified object.
 MetaClass getMetaClassForObject(java.lang.Object object, MetaClassRegistry classRegistry)
          Returns the appropriate meta-class for the specified object.
static MapMetaKit getMetaKit(MetaKit delegate)
          Returns a MapMetaKit for the specified delegate.
 MetaObjectFactory getMetaObjectFactory()
          Returns a factory that can be used to create new MetaObject based values using this kit's underlying implementation.
 int hashCode()
          Because we implement .equals() we should implement hashCode()...
 java.lang.String toString()
           
 MetaObject wrapObject(java.lang.Object object, MetaClass mClass)
          Wraps the specified object in a meta-object adapter specific to this kit's implementation layer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_KIT

public static final MapMetaKit DEFAULT_KIT
Constructor Detail

MapMetaKit

public MapMetaKit(MetaKit delegate)
Creates a map meta-kit that will delegate to the specified MetaKit when it determines that it can't handle a given object on its own.

Method Detail

getMetaKit

public static MapMetaKit getMetaKit(MetaKit delegate)
Returns a MapMetaKit for the specified delegate. If the delegate is null then the DEFAULT_KIT is returned.


getDelegateMetaKit

public MetaKit getDelegateMetaKit()
Returns the meta-kit that this kit will delegate to when dealing with non-map objects.


getInternalObject

public java.lang.Object getInternalObject(MetaObject object)
Returns the internal object representation for the specified meta-object if one exists. For meta-object implementations that wrap an internal object, this will return the internal object. null is returned if the meta-object implementation does not internally wrap real objects.

Specified by:
getInternalObject in interface MetaKit

getMetaClassForObject

public MetaClass getMetaClassForObject(java.lang.Object object,
                                       MetaClassRegistry classRegistry)
Returns the appropriate meta-class for the specified object. If an appropriate meta-class has not been registered then this method returns null.

Specified by:
getMetaClassForObject in interface MetaKit

getMetaClassForObject

public MetaClass getMetaClassForObject(java.lang.Object object)
Returns the appropriate meta-class for the specified object. If an appropriate meta-class has not been registered then this method returns null. The meta-class is looked up in the root class registry.

Specified by:
getMetaClassForObject in interface MetaKit

wrapObject

public MetaObject wrapObject(java.lang.Object object,
                             MetaClass mClass)
Wraps the specified object in a meta-object adapter specific to this kit's implementation layer. Returns null if the object cannot be wrapped. Throws UnsupportedOperationException if this kit doesn't support wrapping.

Specified by:
wrapObject in interface MetaKit

getMetaObjectFactory

public MetaObjectFactory getMetaObjectFactory()
Returns a factory that can be used to create new MetaObject based values using this kit's underlying implementation.

Specified by:
getMetaObjectFactory in interface MetaKit

equals

public boolean equals(java.lang.Object obj)
Pretend to be equals in this direction with any meta-kit that we delegate to. This is because we happen to know which direction the check is done in and this direction is safe. A better solution needs to be figured out for this situation of a value-added meta-kit. Perhaps meta-kits need a compatible() method. FIXME

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Because we implement .equals() we should implement hashCode()... though it just delegates.

Overrides:
hashCode in class java.lang.Object

toString

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


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