org.progeeks.meta.util
Class CachingMetaObjectListAdapter
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList
org.progeeks.meta.util.MetaObjectListAdapter
org.progeeks.meta.util.CachingMetaObjectListAdapter
- All Implemented Interfaces:
- java.lang.Iterable, java.util.Collection, java.util.List
public class CachingMetaObjectListAdapter
- extends MetaObjectListAdapter
Specialization of the MetaObjectListAdapter that knows it
can keep track of and manage its own list of unwrapped objects.
MetaObjectListAdapter is just a view and can therefore only
operate lazily in case the list changes underneath it. There
are cases where we start with the list of wrapped objects and then
create an unwrapped list for storage. In these cases, it is safer
to keep track of everything. There is still the possibility that
the underlying MetaObject implementation will attempt to monkey
with the list directly but keeping our own reference to the list
saves us from some other problems... namely that we don't often
have all of the information necessary to fully recreate a meta-object
from its internal value. Therefore, we should try to keep as much
info around as possible.
A solution to the self-management issues would be to keep an observable
list internally as the unwrapped list. That way if a meta-object impl
messes with it directly then we'll know. Something for later. FIXME
Note: this really only extends MetaObjectListAdapter for some
polymorphism issues in AbstractMetaObject. Could probably be handled
a better way.
- Version:
- $Revision: 1.2 $
- Author:
- Paul Speed
Fields inherited from class java.util.AbstractList |
modCount |
Method Summary |
void |
add(int index,
java.lang.Object value)
|
java.lang.Object |
get(int index)
|
int |
indexOf(java.lang.Object o)
|
java.lang.Object |
remove(int index)
|
java.lang.Object |
set(int index,
java.lang.Object value)
|
Methods inherited from class java.util.AbstractList |
add, addAll, clear, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
CachingMetaObjectListAdapter
public CachingMetaObjectListAdapter(MetaKit metaKit,
MetaClass mClass,
java.util.List wrappers)
set
public java.lang.Object set(int index,
java.lang.Object value)
- Specified by:
set
in interface java.util.List
- Overrides:
set
in class MetaObjectListAdapter
add
public void add(int index,
java.lang.Object value)
- Specified by:
add
in interface java.util.List
- Overrides:
add
in class MetaObjectListAdapter
get
public java.lang.Object get(int index)
- Specified by:
get
in interface java.util.List
- Overrides:
get
in class MetaObjectListAdapter
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interface java.util.List
- Overrides:
indexOf
in class MetaObjectListAdapter
remove
public java.lang.Object remove(int index)
- Specified by:
remove
in interface java.util.List
- Overrides:
remove
in class MetaObjectListAdapter
Copyright © 2002-2003 Paul Speed. All Rights Reserved.