|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.dyuproject.protostuff.runtime.IdStrategy
public abstract class IdStrategy
This base class handles all the IO for reading and writing polymorphic fields. When a field's type is polymorphic/dynamic (e.g interface/abstract/object), the type (id) needs to be written (ahead) before its value/content to be able to deserialize it correctly. The underlying impl will determine how the type (id) should be written.
| Nested Class Summary | |
|---|---|
static interface |
IdStrategy.Factory
Responsible for instantiating custom IdStrategy impls. |
static class |
IdStrategy.UnknownTypeException
Thrown when a type is not known by the IdStrategy. |
| Constructor Summary | |
|---|---|
IdStrategy()
|
|
| Method Summary | ||
|---|---|---|
protected abstract CollectionSchema.MessageFactory |
getCollectionFactory(java.lang.Class<?> clazz)
Returns the CollectionSchema.MessageFactory. |
|
protected abstract EnumIO<? extends java.lang.Enum<?>> |
getEnumIO(java.lang.Class<?> enumClass)
Returns the EnumIO. |
|
protected abstract MapSchema.MessageFactory |
getMapFactory(java.lang.Class<?> clazz)
Returns the MapSchema.MessageFactory. |
|
abstract
|
getSchemaWrapper(java.lang.Class<T> typeClass,
boolean create)
Returns the schema wrapper. |
|
abstract boolean |
isRegistered(java.lang.Class<?> typeClass)
Returns true if the typeClass is explicitly registered. |
|
protected abstract java.lang.Class<?> |
resolveArrayComponentTypeFrom(Input input,
boolean mapped)
|
|
protected abstract CollectionSchema.MessageFactory |
resolveCollectionFrom(Input input)
|
|
protected abstract EnumIO<?> |
resolveEnumFrom(Input input)
|
|
protected abstract MapSchema.MessageFactory |
resolveMapFrom(Input input)
|
|
protected abstract
|
resolvePojoFrom(Input input,
int fieldNumber)
|
|
protected abstract void |
transferArrayId(Input input,
Output output,
int fieldNumber,
boolean mapped)
|
|
protected abstract void |
transferCollectionId(Input input,
Output output,
int fieldNumber)
|
|
protected abstract void |
transferEnumId(Input input,
Output output,
int fieldNumber)
|
|
protected abstract void |
transferMapId(Input input,
Output output,
int fieldNumber)
|
|
protected abstract
|
transferPojoId(Input input,
Output output,
int fieldNumber)
|
|
protected abstract void |
writeArrayIdTo(Output output,
java.lang.Class<?> componentType)
|
|
protected abstract void |
writeCollectionIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
|
|
protected abstract void |
writeEnumIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
|
|
protected abstract void |
writeMapIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
|
|
protected abstract
|
writeMessageIdTo(Output output,
int fieldNumber,
Message<T> message)
|
|
protected abstract
|
writePojoIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IdStrategy()
| Method Detail |
|---|
public abstract boolean isRegistered(java.lang.Class<?> typeClass)
typeClass is explicitly registered.
public abstract <T> HasSchema<T> getSchemaWrapper(java.lang.Class<T> typeClass,
boolean create)
schema wrapper.
The caller is responsible that the typeClass is a pojo (e.g not an enum/array/etc).
protected abstract EnumIO<? extends java.lang.Enum<?>> getEnumIO(java.lang.Class<?> enumClass)
EnumIO.
The callers (internal field factories) are responsible that the class provided
is an enum class.
protected abstract CollectionSchema.MessageFactory getCollectionFactory(java.lang.Class<?> clazz)
CollectionSchema.MessageFactory.
The callers (internal field factories) are responsible that the class provided
implements Collection.
protected abstract MapSchema.MessageFactory getMapFactory(java.lang.Class<?> clazz)
MapSchema.MessageFactory.
The callers (internal field factories}) are responsible that the class provided
implements .
protected abstract void writeCollectionIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
throws java.io.IOException
java.io.IOException
protected abstract void transferCollectionId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
java.io.IOException
protected abstract CollectionSchema.MessageFactory resolveCollectionFrom(Input input)
throws java.io.IOException
java.io.IOException
protected abstract void writeMapIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
throws java.io.IOException
java.io.IOException
protected abstract void transferMapId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
java.io.IOException
protected abstract MapSchema.MessageFactory resolveMapFrom(Input input)
throws java.io.IOException
java.io.IOException
protected abstract void writeEnumIdTo(Output output,
int fieldNumber,
java.lang.Class<?> clazz)
throws java.io.IOException
java.io.IOException
protected abstract void transferEnumId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
java.io.IOException
protected abstract EnumIO<?> resolveEnumFrom(Input input)
throws java.io.IOException
java.io.IOException
protected abstract <T> Schema<T> writePojoIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz)
throws java.io.IOException
java.io.IOException
protected abstract <T> HasSchema<T> transferPojoId(Input input,
Output output,
int fieldNumber)
throws java.io.IOException
java.io.IOException
protected abstract <T> HasSchema<T> resolvePojoFrom(Input input,
int fieldNumber)
throws java.io.IOException
java.io.IOException
protected abstract <T> Schema<T> writeMessageIdTo(Output output,
int fieldNumber,
Message<T> message)
throws java.io.IOException
java.io.IOException
protected abstract void writeArrayIdTo(Output output,
java.lang.Class<?> componentType)
throws java.io.IOException
java.io.IOException
protected abstract void transferArrayId(Input input,
Output output,
int fieldNumber,
boolean mapped)
throws java.io.IOException
java.io.IOException
protected abstract java.lang.Class<?> resolveArrayComponentTypeFrom(Input input,
boolean mapped)
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||