org.progeeks.meta.util
Class RemappedMetaObject

java.lang.Object
  extended by org.progeeks.util.beans.BeanChangeSupport
      extended by org.progeeks.meta.util.RemappedMetaObject
All Implemented Interfaces:
MetaObject, StandardBean

public class RemappedMetaObject
extends BeanChangeSupport
implements MetaObject

A meta-object wrapper that translates property names based on a mapping. Note that property change listeners for the wrapped object still report changes using the wrapped object's property names. Property change listeners registered with this wrapper will receive change events with the mapped names. In addition, this implementation currently makes no attempt to validate the meta-classes of the mappings to make sure that they are compatible.

Version:
$Revision: 1.7 $
Author:
Paul Wisneskey

Constructor Summary
RemappedMetaObject(MetaObject metaObject, MetaClass metaClass, java.util.Map propertyNameMap)
          Constructor that wraps the supplied meta-object and presents to be the given meta-class using the supplied mappings to translate property names.
 
Method Summary
 MetaClass getMetaClass()
          Returns the meta-class of this object (not the wrapped one).
 MetaKit getMetaKit()
          Returns the meta-kit for this meta-object's implementation layer.
 java.lang.Object getProperty(java.lang.String name)
          Get the specified property by finding out what property it maps to in the wrapped object and getting it from that object.
 PropertyMutator getPropertyMutator(java.lang.String name)
          Get the property mutator for the given property.
 void release()
          Releases any internal resources that may be held by the underlying implementation.
 void setProperty(java.lang.String name, java.lang.Object value)
          Set the specified property by finding out what property it maps to in the wrapped object and sending it on.
 
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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.progeeks.meta.MetaObject
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

RemappedMetaObject

public RemappedMetaObject(MetaObject metaObject,
                          MetaClass metaClass,
                          java.util.Map propertyNameMap)
Constructor that wraps the supplied meta-object and presents to be the given meta-class using the supplied mappings to translate property names.

Parameters:
metaObject - Meta-object to remap.
metaClass - Meta-class this remapped object should be.
propertyNameMap - Mapping of meta-class property names to wrapped object property names.
Method Detail

release

public void release()
Releases any internal resources that may be held by the underlying implementation. This clears the internal data structures but does NOT release the remapped meta-object.

Specified by:
release in interface MetaObject

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Set the specified property by finding out what property it maps to in the wrapped object and sending it on.

Specified by:
setProperty in interface MetaObject
See Also:
MetaObject.setProperty(java.lang.String, java.lang.Object)

getProperty

public java.lang.Object getProperty(java.lang.String name)
Get the specified property by finding out what property it maps to in the wrapped object and getting it from that object.

Specified by:
getProperty in interface MetaObject
See Also:
MetaObject.getProperty(java.lang.String)

getPropertyMutator

public PropertyMutator getPropertyMutator(java.lang.String name)
Get the property mutator for the given property.

Specified by:
getPropertyMutator in interface MetaObject
See Also:
MetaObject.getPropertyMutator(java.lang.String)

getMetaClass

public MetaClass getMetaClass()
Returns the meta-class of this object (not the wrapped one).

Specified by:
getMetaClass in interface MetaObject
See Also:
MetaObject.getMetaClass()

getMetaKit

public MetaKit getMetaKit()
Description copied from interface: MetaObject
Returns the meta-kit for this meta-object's implementation layer.

Specified by:
getMetaKit in interface MetaObject
See Also:
MetaObject.getMetaKit()


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