|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.util.lifecycle.impl.AbstractObjectFactoryImpl<T>
org.clazzes.util.lifecycle.impl.AbstractRecyclerImpl<T>
T
- The type of key used for the factory.public abstract class AbstractRecyclerImpl<T>
Abstract base class of type Recycler
using lists of WeakReference
es to cache recycled objects.
Constructor Summary | |
---|---|
protected |
AbstractRecyclerImpl()
|
Method Summary | |
---|---|
ObjectCreatable<T> |
get(T key)
Deliver an object for the passed key. |
protected ObjectCreatable<T> |
internalCreateNew(T key)
Concrete implementations should use this method instead of AbstractObjectFactoryImpl.createNew(Object) to retrieve new objects. |
protected boolean |
isCachable(T key,
ObjectCreatable<T> obj)
Checks if the passed object and key are valid, and the object can be recycled. |
void |
pushBack(T key,
ObjectCreatable<T> obj)
Objects implementing the Recyclable interface must call this method in their Recyclable.recycle()
method with themselves and their key as arguments, to return themselves to the Recycler . |
Methods inherited from class org.clazzes.util.lifecycle.impl.AbstractObjectFactoryImpl |
---|
createNew |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractRecyclerImpl()
Method Detail |
---|
public ObjectCreatable<T> get(T key)
ObjectFactory
get
in interface ObjectFactory<T>
get
in class AbstractObjectFactoryImpl<T>
key
- The key used to identify the object.
public void pushBack(T key, ObjectCreatable<T> obj)
Recycler
Recyclable
interface must call this method in their Recyclable.recycle()
method with themselves and their key
as arguments, to return themselves to the Recycler
.
pushBack
in interface Recycler<T>
key
- the key by which the Recyclable
should be identified to the Recycler
obj
- the object which is to be recycled.protected boolean isCachable(T key, ObjectCreatable<T> obj)
key
- obj
-
protected ObjectCreatable<T> internalCreateNew(T key)
AbstractObjectFactoryImpl
AbstractObjectFactoryImpl.createNew(Object)
to retrieve new objects.
internalCreateNew
in class AbstractObjectFactoryImpl<T>
key
- the key describing the object
key
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |