|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrcf.core.util.adapter.AbstractTypeAdapter<T,R>
rcf.core.util.reference.ReferenceTypeAdapter<T,R>
T - The type of the objects being referenced.@Revision(value="$Revision: 1.7 $",
date="$Date: 2006/11/10 00:09:47 $",
tag="$Name: $")
public class ReferenceTypeAdapter<T,R extends Reference<T>>
TODO: Javadoc
An adapter from objects to references to those objects, which can be used in
conjunction with rcf.core.util.collections and
rcf.core.util.adapter.AdapterHelpers#cast(Object, Class, Object, TypeAdapter[])
to create collections of weak, soft or phantom references.
At it's core this adapter simply wraps and unwraps the objects with the
appropriate references as determined by the _refClass parameter
to ReferenceTypeAdapter(Class, Collection). In addition, this class
includes the update() method which will remove all (now) garbage
collection references created using this adapter from the optional collection
which was specified to ReferenceTypeAdapter(Class, Collection). Note
that the update method is called at every adaptation, allowing it's use to be
fully automatic.
TODO: Unit tests, Code review, Javadoc review, Seal/Finalize
| Field Summary | |
|---|---|
protected rcf.core.util.collection.Collection<R> |
collection
TODO: Javadoc The collection which this adapter is managing the contents of. |
protected ReferenceQueue<T> |
queue
TODO: Javadoc The reference queue which garbage collected objects are put into. |
protected Constructor<R> |
refConstructor
TODO: Javadoc The constructor to use when constructing reference objects. |
| Fields inherited from class rcf.core.util.adapter.AbstractTypeAdapter |
|---|
adapterInverse |
| Constructor Summary | |
|---|---|
ReferenceTypeAdapter(Class<R> _refClass,
rcf.core.util.collection.Collection<R> _collection)
TODO: Javadoc Consruct a new reference adapter, which will wrap objects in references of the given class, and which will remove garbage collection references from the given collection. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
|
int |
hashCode()
|
R |
mapA(T a)
|
T |
mapB(R b)
|
String |
toString()
|
void |
update()
TODO: Javadoc Remove all of the garbage collected references which were generated by this adapter from the collection which was specified to ReferenceTypeAdapter(Class, Collection). |
| Methods inherited from class rcf.core.util.adapter.AbstractTypeAdapter |
|---|
typeAdapterInverse |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final rcf.core.util.collection.Collection<R extends Reference<T>> collection
protected final ReferenceQueue<T> queue
protected final Constructor<R extends Reference<T>> refConstructor
| Constructor Detail |
|---|
public ReferenceTypeAdapter(Class<R> _refClass,
rcf.core.util.collection.Collection<R> _collection)
_refClass - The reference class to wrap objects in._collection - The collection which calls to update() (and
the adapter methods) will remove garbage collected
references from.| Method Detail |
|---|
public R mapA(T a)
public T mapB(R b)
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic void update()
ReferenceTypeAdapter(Class, Collection). If no collection was
specified, this method will do nothing. Furthermore, this method will only
remove references created by this reference type adapter!
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||