public abstract class IdStrategy extends Object
The underlying impl will determine how the type (id) should be written.
An 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 |
|---|---|
static int |
ALLOW_NULL_ARRAY_ELEMENT |
static int |
AUTO_LOAD_POLYMORPHIC_CLASSES |
static int |
COLLECTION_SCHEMA_ON_REPEATED_FIELDS |
static int |
DEFAULT_FLAGS |
static int |
ENUMS_BY_NAME |
int |
flags |
int |
groupId |
static int |
MORPH_COLLECTION_INTERFACES |
static int |
MORPH_MAP_INTERFACES |
static int |
MORPH_NON_FINAL_POJOS |
static int |
POJO_SCHEMA_ON_COLLECTION_FIELDS |
static int |
POJO_SCHEMA_ON_MAP_FIELDS |
IdStrategy |
primaryGroup |
| Modifier | Constructor and Description |
|---|---|
protected |
IdStrategy(int flags,
IdStrategy primaryGroup,
int groupId) |
| Modifier and Type | Method and Description |
|---|---|
protected static <T> T |
createMessageInstance(Class<T> clazz) |
protected abstract CollectionSchema.MessageFactory |
getCollectionFactory(Class<?> clazz)
Returns the
CollectionSchema.MessageFactory. |
abstract <T> Delegate<T> |
getDelegate(Class<? super T> typeClass)
Returns the
delegate. |
abstract <T> HasDelegate<T> |
getDelegateWrapper(Class<? super T> typeClass)
Returns the
delegate. |
protected abstract EnumIO<? extends Enum<?>> |
getEnumIO(Class<?> enumClass)
Returns the
EnumIO. |
protected abstract MapSchema.MessageFactory |
getMapFactory(Class<?> clazz)
Returns the
MapSchema.MessageFactory. |
abstract <T> HasSchema<T> |
getSchemaWrapper(Class<T> typeClass,
boolean create)
Returns the
schema wrapper. |
abstract boolean |
isDelegateRegistered(Class<?> typeClass)
Returns true if there is a
Delegate explicitly registered for the typeClass. |
abstract boolean |
isRegistered(Class<?> typeClass)
Returns true if the
typeClass is explicitly registered. |
protected <T> Schema<T> |
newSchema(Class<T> typeClass)
Generates a schema from the given class.
|
protected abstract Class<?> |
resolveArrayComponentTypeFrom(Input input,
boolean mapped) |
protected abstract 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 void |
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,
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,
Class<T> clazz,
boolean registered) |
protected abstract void |
writeArrayIdTo(Output output,
Class<?> componentType) |
protected abstract void |
writeClassIdTo(Output output,
Class<?> componentType,
boolean array) |
protected abstract void |
writeCollectionIdTo(Output output,
int fieldNumber,
Class<?> clazz) |
protected abstract void |
writeEnumIdTo(Output output,
int fieldNumber,
Class<?> clazz) |
protected abstract void |
writeMapIdTo(Output output,
int fieldNumber,
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,
Class<T> clazz) |
public static final int ENUMS_BY_NAME
public static final int AUTO_LOAD_POLYMORPHIC_CLASSES
public static final int ALLOW_NULL_ARRAY_ELEMENT
public static final int MORPH_NON_FINAL_POJOS
public static final int MORPH_COLLECTION_INTERFACES
public static final int MORPH_MAP_INTERFACES
public static final int COLLECTION_SCHEMA_ON_REPEATED_FIELDS
public static final int POJO_SCHEMA_ON_COLLECTION_FIELDS
public static final int POJO_SCHEMA_ON_MAP_FIELDS
public static final int DEFAULT_FLAGS
public final int flags
public final IdStrategy primaryGroup
public final int groupId
protected IdStrategy(int flags,
IdStrategy primaryGroup,
int groupId)
protected <T> Schema<T> newSchema(Class<T> typeClass)
public abstract boolean isDelegateRegistered(Class<?> typeClass)
Delegate explicitly registered for the typeClass.public abstract <T> HasDelegate<T> getDelegateWrapper(Class<? super T> typeClass)
delegate.public abstract <T> Delegate<T> getDelegate(Class<? super T> typeClass)
delegate.public abstract boolean isRegistered(Class<?> typeClass)
typeClass is explicitly registered.public abstract <T> HasSchema<T> getSchemaWrapper(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 Enum<?>> getEnumIO(Class<?> enumClass)
EnumIO. The callers (internal field factories) are responsible that the class provided is an
enum class.protected abstract CollectionSchema.MessageFactory getCollectionFactory(Class<?> clazz)
CollectionSchema.MessageFactory. The callers (internal field factories) are responsible that
the class provided implements Collection.protected abstract MapSchema.MessageFactory getMapFactory(Class<?> clazz)
MapSchema.MessageFactory. The callers (internal field factories}) are responsible that the
class provided implements Map.protected abstract void writeCollectionIdTo(Output output, int fieldNumber, Class<?> clazz) throws IOException
IOExceptionprotected abstract void transferCollectionId(Input input, Output output, int fieldNumber) throws IOException
IOExceptionprotected abstract CollectionSchema.MessageFactory resolveCollectionFrom(Input input) throws IOException
IOExceptionprotected abstract void writeMapIdTo(Output output, int fieldNumber, Class<?> clazz) throws IOException
IOExceptionprotected abstract void transferMapId(Input input, Output output, int fieldNumber) throws IOException
IOExceptionprotected abstract MapSchema.MessageFactory resolveMapFrom(Input input) throws IOException
IOExceptionprotected abstract void writeEnumIdTo(Output output, int fieldNumber, Class<?> clazz) throws IOException
IOExceptionprotected abstract void transferEnumId(Input input, Output output, int fieldNumber) throws IOException
IOExceptionprotected abstract EnumIO<?> resolveEnumFrom(Input input) throws IOException
IOExceptionprotected abstract <T> HasSchema<T> tryWritePojoIdTo(Output output, int fieldNumber, Class<T> clazz, boolean registered) throws IOException
IOExceptionprotected abstract <T> HasSchema<T> writePojoIdTo(Output output, int fieldNumber, Class<T> clazz) throws IOException
IOExceptionprotected abstract <T> HasSchema<T> transferPojoId(Input input, Output output, int fieldNumber) throws IOException
IOExceptionprotected abstract <T> HasSchema<T> resolvePojoFrom(Input input, int fieldNumber) throws IOException
IOExceptionprotected abstract <T> Schema<T> writeMessageIdTo(Output output, int fieldNumber, Message<T> message) throws IOException
IOExceptionprotected abstract <T> HasDelegate<T> tryWriteDelegateIdTo(Output output, int fieldNumber, Class<T> clazz) throws IOException
IOExceptionprotected abstract <T> HasDelegate<T> transferDelegateId(Input input, Output output, int fieldNumber) throws IOException
IOExceptionprotected abstract <T> HasDelegate<T> resolveDelegateFrom(Input input) throws IOException
IOExceptionprotected abstract void writeArrayIdTo(Output output, Class<?> componentType) throws IOException
IOExceptionprotected abstract void transferArrayId(Input input, Output output, int fieldNumber, boolean mapped) throws IOException
IOExceptionprotected abstract Class<?> resolveArrayComponentTypeFrom(Input input, boolean mapped) throws IOException
IOExceptionprotected abstract void writeClassIdTo(Output output, Class<?> componentType, boolean array) throws IOException
IOExceptionprotected abstract void transferClassId(Input input, Output output, int fieldNumber, boolean mapped, boolean array) throws IOException
IOExceptionprotected abstract Class<?> resolveClassFrom(Input input, boolean mapped, boolean array) throws IOException
IOExceptionprotected static <T> T createMessageInstance(Class<T> clazz)
Copyright © 2009–2020. All rights reserved.