org.objectweb.dream.message
Class AbstractChunk<T extends AbstractChunk<T>>
java.lang.Object
org.objectweb.dream.message.AbstractChunk<T>
- Type Parameters:
T
- the concrete chunk type.
- All Implemented Interfaces:
- Externalizable, Serializable, Recyclable
public abstract class AbstractChunk<T extends AbstractChunk<T>>
- extends Object
- implements Externalizable, Recyclable
Base class of every chunk classes. This class is parameterized with a type of
the form T extends AbstractChunk<T>
. This means that a
concrete chunk class must be declare as following:
public class ChunkClass extends AbstractChunk<ChunkClass> { ... }
This way, the class ChunkClass
respects the pattern
T extends AbstractChunk<T>
, and instances of
ChunkClass
have a field of type
ChunkFactoryReference<ChunkClass>
.
This generic type implies a limitation: any sub class of
ChunkClass
is not a valid chunk type. For instance a class
defined as following :
public class SubChunkClass extends ChunkClass { ... }
does not match the pattern T extends AbstractChunk<T>
,
since it matches
SubChunkClass extends AbstractChunk<ChunkClass>
.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractChunk
public AbstractChunk()
newChunk
protected abstract T newChunk()
transfertStateTo
protected abstract void transfertStateTo(T newInstance)
setReference
public void setReference(Reference<? extends Recyclable> reference)
- Description copied from interface:
Recyclable
- Sets a
Reference
object that can be used by object pool
implementation. This field must not be erase by the
Recyclable.recycle()
method.
- Specified by:
setReference
in interface Recyclable
- Parameters:
reference
- a Reference
object that can be used by object pool
implementation.- See Also:
Recyclable.setReference(Reference)
getReference
public Reference<? extends Recyclable> getReference()
- Description copied from interface:
Recyclable
- Returns the reference object set by the
Recyclable.setReference(Reference)
method.
- Specified by:
getReference
in interface Recyclable
- Returns:
- a
Reference
object that can be used by object pool
implementation. - See Also:
Recyclable.getReference()
Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.