public abstract class IdStrategy
extends java.lang.Object
IdStrategy is standalone if the primaryGroup is not set.| Modifier and Type | Class and Description |
|---|---|
static interface |
IdStrategy.Factory
Responsible for instantiating custom
IdStrategy impls. |
static class |
IdStrategy.UnknownTypeException
Thrown when a type is not known by the IdStrategy.
|
| Modifier and Type | Field and Description |
|---|---|
int |
groupId |
IdStrategy |
primaryGroup |
| Modifier | Constructor and Description |
|---|---|
protected |
IdStrategy(IdStrategy primaryGroup,
int groupId) |
| Modifier and Type | Method and Description |
|---|---|
protected static <T> T |
createMessageInstance(java.lang.Class<T> clazz) |
protected abstract CollectionSchema.MessageFactory |
getCollectionFactory(java.lang.Class<?> clazz)
Returns the
CollectionSchema.MessageFactory. |
abstract <T> Delegate<T> |
getDelegate(java.lang.Class<? super T> typeClass)
Returns the
delegate. |
abstract <T> HasDelegate<T> |
getDelegateWrapper(java.lang.Class<? super T> typeClass)
Returns the
delegate. |
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 <T> HasSchema<T> |
getRegistered(java.lang.Class<?> typeClass)
Returns the wrapper for the registered schema.
|
abstract <T> HasSchema<T> |
getSchemaWrapper(java.lang.Class<T> typeClass,
boolean create)
Returns the
schema wrapper. |
abstract boolean |
isDelegateRegistered(java.lang.Class<?> typeClass)
Returns true if there is a
Delegate explicitly registered for the
typeClass. |
abstract boolean |
isRegistered(java.lang.Class<?> typeClass)
Returns true if the
typeClass is explicitly registered. |
protected <T> Schema<T> |
newSchema(java.lang.Class<T> typeClass)
Generates a schema from the given class.
|
protected abstract java.lang.Class<?> |
resolveArrayComponentTypeFrom(Input input,
boolean mapped) |
protected abstract java.lang.Class<?> |
resolveClassFrom(Input input,
boolean mapped,
boolean array) |
protected abstract CollectionSchema.MessageFactory |
resolveCollectionFrom(Input input) |
protected abstract <T> HasDelegate<T> |
resolveDelegateFrom(Input input) |
protected abstract EnumIO<?> |
resolveEnumFrom(Input input) |
protected abstract MapSchema.MessageFactory |
resolveMapFrom(Input input) |
protected abstract <T> HasSchema<T> |
resolvePojoFrom(Input input,
int fieldNumber) |
protected abstract void |
transferArrayId(Input input,
Output output,
int fieldNumber,
boolean mapped) |
protected abstract void |
transferClassId(Input input,
Output output,
int fieldNumber,
boolean mapped,
boolean array) |
protected abstract void |
transferCollectionId(Input input,
Output output,
int fieldNumber) |
protected abstract <T> HasDelegate<T> |
transferDelegateId(Input input,
Output output,
int fieldNumber) |
protected abstract EnumIO<?> |
transferEnumId(Input input,
Output output,
int fieldNumber) |
protected abstract void |
transferMapId(Input input,
Output output,
int fieldNumber) |
protected abstract <T> HasSchema<T> |
transferPojoId(Input input,
Output output,
int fieldNumber) |
protected abstract <T> HasDelegate<T> |
tryWriteDelegateIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz)
If this method returns null, the clazz was not registered as a delegate.
|
protected abstract <T> HasSchema<T> |
tryWritePojoIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz,
boolean registered) |
protected abstract void |
writeArrayIdTo(Output output,
java.lang.Class<?> componentType) |
protected abstract void |
writeClassIdTo(Output output,
java.lang.Class<?> componentType,
boolean array) |
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 <T> Schema<T> |
writeMessageIdTo(Output output,
int fieldNumber,
Message<T> message) |
protected abstract <T> HasSchema<T> |
writePojoIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz) |
protected abstract <T> void |
writePojoIdTo(Output output,
int fieldNumber,
java.lang.Class<T> clazz,
HasSchema<T> hs) |
public final IdStrategy primaryGroup
public final int groupId
protected IdStrategy(IdStrategy primaryGroup, int groupId)
protected <T> Schema<T> newSchema(java.lang.Class<T> typeClass)
public abstract boolean isDelegateRegistered(java.lang.Class<?> typeClass)
Delegate explicitly registered for the
typeClass.public abstract <T> HasDelegate<T> getDelegateWrapper(java.lang.Class<? super T> typeClass)
delegate.public abstract <T> Delegate<T> getDelegate(java.lang.Class<? super T> typeClass)
delegate.public abstract boolean isRegistered(java.lang.Class<?> typeClass)
typeClass is explicitly registered.public abstract <T> HasSchema<T> getRegistered(java.lang.Class<?> typeClass)
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.IOExceptionprotected abstract void transferCollectionId(Input input, Output output, int fieldNumber) throws java.io.IOException
java.io.IOExceptionprotected abstract CollectionSchema.MessageFactory resolveCollectionFrom(Input input) throws java.io.IOException
java.io.IOExceptionprotected abstract void writeMapIdTo(Output output, int fieldNumber, java.lang.Class<?> clazz) throws java.io.IOException
java.io.IOExceptionprotected abstract void transferMapId(Input input, Output output, int fieldNumber) throws java.io.IOException
java.io.IOExceptionprotected abstract MapSchema.MessageFactory resolveMapFrom(Input input) throws java.io.IOException
java.io.IOExceptionprotected abstract void writeEnumIdTo(Output output, int fieldNumber, java.lang.Class<?> clazz) throws java.io.IOException
java.io.IOExceptionprotected abstract EnumIO<?> transferEnumId(Input input, Output output, int fieldNumber) throws java.io.IOException
java.io.IOExceptionprotected abstract EnumIO<?> resolveEnumFrom(Input input) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> HasSchema<T> tryWritePojoIdTo(Output output, int fieldNumber, java.lang.Class<T> clazz, boolean registered) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> void writePojoIdTo(Output output, int fieldNumber, java.lang.Class<T> clazz, HasSchema<T> hs) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> HasSchema<T> writePojoIdTo(Output output, int fieldNumber, java.lang.Class<T> clazz) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> HasSchema<T> transferPojoId(Input input, Output output, int fieldNumber) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> HasSchema<T> resolvePojoFrom(Input input, int fieldNumber) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> Schema<T> writeMessageIdTo(Output output, int fieldNumber, Message<T> message) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> HasDelegate<T> tryWriteDelegateIdTo(Output output, int fieldNumber, java.lang.Class<T> clazz) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> HasDelegate<T> transferDelegateId(Input input, Output output, int fieldNumber) throws java.io.IOException
java.io.IOExceptionprotected abstract <T> HasDelegate<T> resolveDelegateFrom(Input input) throws java.io.IOException
java.io.IOExceptionprotected abstract void writeArrayIdTo(Output output, java.lang.Class<?> componentType) throws java.io.IOException
java.io.IOExceptionprotected abstract void transferArrayId(Input input, Output output, int fieldNumber, boolean mapped) throws java.io.IOException
java.io.IOExceptionprotected abstract java.lang.Class<?> resolveArrayComponentTypeFrom(Input input, boolean mapped) throws java.io.IOException
java.io.IOExceptionprotected abstract void writeClassIdTo(Output output, java.lang.Class<?> componentType, boolean array) throws java.io.IOException
java.io.IOExceptionprotected abstract void transferClassId(Input input, Output output, int fieldNumber, boolean mapped, boolean array) throws java.io.IOException
java.io.IOExceptionprotected abstract java.lang.Class<?> resolveClassFrom(Input input, boolean mapped, boolean array) throws java.io.IOException
java.io.IOExceptionprotected static <T> T createMessageInstance(java.lang.Class<T> clazz)
Copyright © 2009-2023. All Rights Reserved.