|
|||||||||
| Home >> All >> org >> progeeks >> [ meta overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.progeeks.meta
Class AbstractMetaObject

java.lang.Objectorg.progeeks.util.beans.BeanChangeSupport
org.progeeks.meta.AbstractMetaObject
- All Implemented Interfaces:
- MetaObject, org.progeeks.util.beans.StandardBean
- public abstract class AbstractMetaObject
- extends org.progeeks.util.beans.BeanChangeSupport
- implements MetaObject
- extends org.progeeks.util.beans.BeanChangeSupport
An abstract meta-object implementation making it easier to create kit-specific meta-object adapters. Hooks are provided to allow subclasses to override specific functionality that may be important to a meta-kit implementation. Subclasses must provide, at the minimum, getProperty() and setProperty() methods.
- Version:
- $Revision: 1.5 $
| Nested Class Summary | |
protected class |
AbstractMetaObject.BaseListMutator
Overridden to provide access to a firePropertyChange() method. |
| Field Summary | |
private MetaClass |
metaClass
|
private MetaKit |
metaKit
|
private java.util.Map |
wrappedValues
|
| Fields inherited from class org.progeeks.util.beans.BeanChangeSupport |
|
| Constructor Summary | |
protected |
AbstractMetaObject(MetaClass metaClass,
MetaKit metaKit)
Creates a meta-object that will use the specified meta-kit and meta-class. |
protected |
AbstractMetaObject(MetaKit metaKit)
Creates a meta-object that will use the specified meta-kit. |
| Method Summary | |
protected void |
cacheWrapper(java.lang.String name,
java.lang.Object value)
Sticks a wrapped value into the wrapper cache. |
protected ListMutator |
createListMutator(java.lang.String name)
Creates a ListMutator for the specified property. |
protected PropertyMutator |
createPropertyMutator(java.lang.String name)
Creates a PropertyMutator for the specified property. |
protected java.lang.Object |
getCachedWrapper(java.lang.String name)
Retrieves a wrapped value from the wrapper cache. |
MetaClass |
getMetaClass()
Returns the meta-class associated with this object. |
MetaKit |
getMetaKit()
Returns the meta-kit for this meta-object's implementation layer. |
java.lang.Object |
getProperty(java.lang.String name)
Returns the value of the specified property. |
PropertyMutator |
getPropertyMutator(java.lang.String name)
Returns a mutator for the specified property. |
protected abstract java.lang.Object |
getPropertyValue(java.lang.String name)
Overridden by subclasses to provide implementation-specific field-level access. |
protected void |
setMetaClass(MetaClass metaClass)
Called by subclasses to set the meta-class when setting it on the constructor is not possible. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets the value of the specified property. |
protected abstract java.lang.Object |
setPropertyValue(java.lang.String name,
java.lang.Object value)
Overridden by subclasses to provide implementation-specific field-level access. |
protected java.lang.Object |
unwrapPropertyValue(java.lang.Object value)
Unwraps the object as appropriate to pass to the internal setPropertyValue() method or returns the original value if no unwrapping is needed. |
protected java.lang.Object |
wrapPropertyValue(java.lang.String name,
PropertyType type,
java.lang.Object value)
Wraps the object as appropriate to return to a caller or returns the original value if no wrapping is needed. |
| Methods inherited from class org.progeeks.util.beans.BeanChangeSupport |
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
| Field Detail |
metaKit
private MetaKit metaKit
metaClass
private MetaClass metaClass
wrappedValues
private java.util.Map wrappedValues
| Constructor Detail |
AbstractMetaObject
protected AbstractMetaObject(MetaClass metaClass, MetaKit metaKit)
- Creates a meta-object that will use the specified
meta-kit and meta-class.
AbstractMetaObject
protected AbstractMetaObject(MetaKit metaKit)
- Creates a meta-object that will use the specified
meta-kit. The metaClass must be set by subclasses by calling
the setMetaClass() method before any other local methods
are accessed.
| Method Detail |
setMetaClass
protected void setMetaClass(MetaClass metaClass)
- Called by subclasses to set the meta-class when setting
it on the constructor is not possible. The meta-class
can only be set once or a RuntimeException will be thrown.
setPropertyValue
protected abstract java.lang.Object setPropertyValue(java.lang.String name, java.lang.Object value)
- Overridden by subclasses to provide implementation-specific
field-level access.
getPropertyValue
protected abstract java.lang.Object getPropertyValue(java.lang.String name)
- Overridden by subclasses to provide implementation-specific
field-level access.
cacheWrapper
protected void cacheWrapper(java.lang.String name, java.lang.Object value)
- Sticks a wrapped value into the wrapper cache.
getCachedWrapper
protected java.lang.Object getCachedWrapper(java.lang.String name)
- Retrieves a wrapped value from the wrapper cache.
wrapPropertyValue
protected java.lang.Object wrapPropertyValue(java.lang.String name, PropertyType type, java.lang.Object value)
- Wraps the object as appropriate to return to a caller or
returns the original value if no wrapping is needed. This
implementation checks the property type and wraps objects
in meta-objects or MetaObjectListAdapters if needed. Wrapped
values are cached in an internal HashMap to speed later retrievals
and reuse meta-objects as much as possible. Objects are wrapped
using the local MetaKit.
unwrapPropertyValue
protected java.lang.Object unwrapPropertyValue(java.lang.Object value)
- Unwraps the object as appropriate to pass to the internal
setPropertyValue() method or returns the original value if no
unwrapping is needed. This implementation currently only
checks for MetaObjectListAdapter values and returns the internal
list. MetaObjects that can from a different meta-kit are not
properly unwrapped yet. This is because technically a local
meta-kit version of the meta-object created and the properties
copied. This will be easier at a future time and is unnecessary
for most users.
setProperty
public void setProperty(java.lang.String name, java.lang.Object value)
- Sets the value of the specified property. The default
implementation does some initial type checking, unwraps
the value as needed by calling unwrapPropertyValue() and
then calls setPropertyValue() before firing a change event.
- Specified by:
setPropertyin interfaceMetaObject
getProperty
public java.lang.Object getProperty(java.lang.String name)
- Returns the value of the specified property. The
default version calls getPropertyValue() to retrieve
the property value and then wraps the value as needed
by calling wrapPropertyValue() before returning it.
- Specified by:
getPropertyin interfaceMetaObject
getPropertyMutator
public PropertyMutator getPropertyMutator(java.lang.String name)
- Returns a mutator for the specified property. This implementation
calls createListMutator() or createPropertyMutator() as is appropriate
based on the PropertyInfo class.
- Specified by:
getPropertyMutatorin interfaceMetaObject
getMetaClass
public MetaClass getMetaClass()
- Returns the meta-class associated with this object.
- Specified by:
getMetaClassin interfaceMetaObject
getMetaKit
public MetaKit getMetaKit()
- Returns the meta-kit for this meta-object's implementation
layer.
- Specified by:
getMetaKitin interfaceMetaObject
createPropertyMutator
protected PropertyMutator createPropertyMutator(java.lang.String name)
- Creates a PropertyMutator for the specified property. The
default implementation creates a DefaultPropertyMutator.
createListMutator
protected ListMutator createListMutator(java.lang.String name)
- Creates a ListMutator for the specified property. The
default implementation creates an instance of the inner
class BaseListMutator which is derived from
DefaultListMutator.
|
|||||||||
| Home >> All >> org >> progeeks >> [ meta overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC