Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.progeeks.meta
Class DefaultListMutator  view DefaultListMutator download DefaultListMutator.java

java.lang.Object
  extended byorg.progeeks.meta.AbstractListMutator
      extended byorg.progeeks.meta.DefaultListMutator
All Implemented Interfaces:
ListMutator, PropertyMutator
Direct Known Subclasses:
AbstractMetaObject.BaseListMutator

public abstract class DefaultListMutator
extends AbstractListMutator
implements ListMutator

A default implementation of ListMutator that will work with any MetaObject, given certain restrictions. It can be used as an implementation on its own or subclassed to provide performance improvements in metakit implementation specific cases. Subclasses must implement the firePropertyChangeEvent() event method to support delivery of list change events.

Version:
$Revision: 1.2 $

Nested Class Summary
 
Nested classes inherited from class org.progeeks.meta.AbstractListMutator
 
Field Summary
private  MetaObject metaObject
           
private  java.lang.String propertyName
           
 
Constructor Summary
DefaultListMutator(java.lang.String propertyName, MetaObject metaObject)
           
 
Method Summary
 void add(int index, java.lang.Object object)
          Adds the object to the list value at the specified index.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds the specified PropertyChangeListener to this mutator.
protected abstract  void firePropertyChangeEvent(java.beans.PropertyChangeEvent event)
          Implemented by subclasses to deliver a change event to the appropriately registered listeners.
 java.lang.Object get(int index)
          Returns the object at the specified location.
protected  java.util.List getListValue()
           
 MetaObject getParentObject()
          Returns the object that contains this property.
 PropertyInfo getPropertyInfo()
          Returns the info associated with this property.
 java.lang.String getPropertyName()
          Returns the name of this property.
 java.lang.Object getValue()
          Returns the value of this property.
 java.lang.Object remove(int index)
          Removes the object at the specified location and returns the locations value prior to removal.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes the specified PropertyChangeListener from this mutator.
 java.lang.Object set(int index, java.lang.Object object)
          Replaces the value at the specified location.
 void setValue(java.lang.Object value)
          Resets the value of this property.
 int size()
          Returns the number of elements in the list value.
 
Methods inherited from class org.progeeks.meta.AbstractListMutator
add, clear, fireElementsInserted, fireElementsModified, fireElementsRemoved, iterator, remove
 
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.ListMutator
add, clear, iterator, remove
 

Field Detail

propertyName

private java.lang.String propertyName

metaObject

private MetaObject metaObject
Constructor Detail

DefaultListMutator

public DefaultListMutator(java.lang.String propertyName,
                          MetaObject metaObject)
Method Detail

getPropertyName

public java.lang.String getPropertyName()
Returns the name of this property.

Specified by:
getPropertyName in interface PropertyMutator

getParentObject

public MetaObject getParentObject()
Returns the object that contains this property.

Specified by:
getParentObject in interface PropertyMutator

getPropertyInfo

public PropertyInfo getPropertyInfo()
Returns the info associated with this property.

Specified by:
getPropertyInfo in interface PropertyMutator

getValue

public java.lang.Object getValue()
Returns the value of this property.

Specified by:
getValue in interface PropertyMutator

setValue

public void setValue(java.lang.Object value)
Resets the value of this property.

Specified by:
setValue in interface PropertyMutator

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds the specified PropertyChangeListener to this mutator.

Specified by:
addPropertyChangeListener in interface PropertyMutator

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes the specified PropertyChangeListener from this mutator.

Specified by:
removePropertyChangeListener in interface PropertyMutator

getListValue

protected java.util.List getListValue()

size

public int size()
Description copied from interface: ListMutator
Returns the number of elements in the list value.

Specified by:
size in interface ListMutator
Specified by:
size in class AbstractListMutator

add

public void add(int index,
                java.lang.Object object)
Description copied from interface: ListMutator
Adds the object to the list value at the specified index.

Specified by:
add in interface ListMutator
Overrides:
add in class AbstractListMutator

set

public java.lang.Object set(int index,
                            java.lang.Object object)
Description copied from interface: ListMutator
Replaces the value at the specified location.

Specified by:
set in interface ListMutator
Overrides:
set in class AbstractListMutator

remove

public java.lang.Object remove(int index)
Description copied from interface: ListMutator
Removes the object at the specified location and returns the locations value prior to removal.

Specified by:
remove in interface ListMutator
Overrides:
remove in class AbstractListMutator

get

public java.lang.Object get(int index)
Description copied from interface: ListMutator
Returns the object at the specified location.

Specified by:
get in interface ListMutator
Specified by:
get in class AbstractListMutator

firePropertyChangeEvent

protected abstract void firePropertyChangeEvent(java.beans.PropertyChangeEvent event)
Description copied from class: AbstractListMutator
Implemented by subclasses to deliver a change event to the appropriately registered listeners.

Specified by:
firePropertyChangeEvent in class AbstractListMutator