public final class DefaultIdStrategy extends IdStrategy
IdStrategy.Factory, IdStrategy.UnknownTypeExceptionALLOW_NULL_ARRAY_ELEMENT, AUTO_LOAD_POLYMORPHIC_CLASSES, COLLECTION_SCHEMA_ON_REPEATED_FIELDS, DEFAULT_FLAGS, ENUMS_BY_NAME, flags, groupId, MORPH_COLLECTION_INTERFACES, MORPH_MAP_INTERFACES, MORPH_NON_FINAL_POJOS, POJO_SCHEMA_ON_COLLECTION_FIELDS, POJO_SCHEMA_ON_MAP_FIELDS, primaryGroup| Constructor and Description |
|---|
DefaultIdStrategy() |
DefaultIdStrategy(IdStrategy primaryGroup,
int groupId) |
DefaultIdStrategy(int flags) |
DefaultIdStrategy(int flags,
IdStrategy primaryGroup,
int groupId) |
| Modifier and Type | Method and Description |
|---|---|
protected CollectionSchema.MessageFactory |
getCollectionFactory(Class<?> clazz)
Returns the
CollectionSchema.MessageFactory. |
<T> Delegate<T> |
getDelegate(Class<? super T> typeClass)
Returns the
delegate. |
<T> HasDelegate<T> |
getDelegateWrapper(Class<? super T> typeClass)
Returns the
delegate. |
protected EnumIO<? extends Enum<?>> |
getEnumIO(Class<?> enumClass)
Returns the
EnumIO. |
protected MapSchema.MessageFactory |
getMapFactory(Class<?> clazz)
Returns the
MapSchema.MessageFactory. |
<T> HasSchema<T> |
getSchemaWrapper(Class<T> typeClass,
boolean create)
Returns the
schema wrapper. |
boolean |
isDelegateRegistered(Class<?> typeClass)
Returns true if there is a
Delegate explicitly registered for the typeClass. |
boolean |
isRegistered(Class<?> typeClass)
Returns true if the
typeClass is explicitly registered. |
<T> boolean |
map(Class<? super T> baseClass,
Class<T> typeClass)
Used by
RuntimeSchema.map(Class, Class). |
boolean |
registerCollection(CollectionSchema.MessageFactory factory)
Registers a collection.
|
<T> boolean |
registerDelegate(Delegate<T> delegate)
Registers a delegate.
|
<T> boolean |
registerDelegate(String className,
Delegate<T> delegate)
Registers a delegate by specifying the class name.
|
<T extends Enum<T>> |
registerEnum(Class<T> enumClass)
Registers an enum.
|
boolean |
registerMap(MapSchema.MessageFactory factory)
Registers a map.
|
<T> boolean |
registerPojo(Class<T> typeClass)
Registers a pojo.
|
<T> boolean |
registerPojo(Class<T> typeClass,
Schema<T> schema)
Registers a pojo.
|
protected Class<?> |
resolveArrayComponentTypeFrom(Input input,
boolean mapped) |
protected Class<?> |
resolveClassFrom(Input input,
boolean mapped,
boolean array) |
protected CollectionSchema.MessageFactory |
resolveCollectionFrom(Input input) |
protected <T> HasDelegate<T> |
resolveDelegateFrom(Input input) |
protected EnumIO<?> |
resolveEnumFrom(Input input) |
protected MapSchema.MessageFactory |
resolveMapFrom(Input input) |
protected <T> HasSchema<T> |
resolvePojoFrom(Input input,
int fieldNumber) |
protected void |
transferArrayId(Input input,
Output output,
int fieldNumber,
boolean mapped) |
protected void |
transferClassId(Input input,
Output output,
int fieldNumber,
boolean mapped,
boolean array) |
protected void |
transferCollectionId(Input input,
Output output,
int fieldNumber) |
protected <T> HasDelegate<T> |
transferDelegateId(Input input,
Output output,
int fieldNumber) |
protected void |
transferEnumId(Input input,
Output output,
int fieldNumber) |
protected void |
transferMapId(Input input,
Output output,
int fieldNumber) |
protected <T> HasSchema<T> |
transferPojoId(Input input,
Output output,
int fieldNumber) |
protected <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 <T> HasSchema<T> |
tryWritePojoIdTo(Output output,
int fieldNumber,
Class<T> clazz,
boolean registered) |
protected void |
writeArrayIdTo(Output output,
Class<?> componentType) |
protected void |
writeClassIdTo(Output output,
Class<?> componentType,
boolean array) |
protected void |
writeCollectionIdTo(Output output,
int fieldNumber,
Class<?> clazz) |
protected void |
writeEnumIdTo(Output output,
int fieldNumber,
Class<?> clazz) |
protected void |
writeMapIdTo(Output output,
int fieldNumber,
Class<?> clazz) |
protected <T> Schema<T> |
writeMessageIdTo(Output output,
int fieldNumber,
Message<T> message) |
protected <T> HasSchema<T> |
writePojoIdTo(Output output,
int fieldNumber,
Class<T> clazz) |
createMessageInstance, newSchemapublic DefaultIdStrategy()
public DefaultIdStrategy(IdStrategy primaryGroup, int groupId)
public DefaultIdStrategy(int flags)
public DefaultIdStrategy(int flags,
IdStrategy primaryGroup,
int groupId)
public <T> boolean registerPojo(Class<T> typeClass, Schema<T> schema)
RuntimeSchema.register(Class, Schema).public <T> boolean registerPojo(Class<T> typeClass)
public <T extends Enum<T>> boolean registerEnum(Class<T> enumClass)
public <T> boolean registerDelegate(Delegate<T> delegate)
public <T> boolean registerDelegate(String className, Delegate<T> delegate)
public boolean registerCollection(CollectionSchema.MessageFactory factory)
public boolean registerMap(MapSchema.MessageFactory factory)
public <T> boolean map(Class<? super T> baseClass, Class<T> typeClass)
RuntimeSchema.map(Class, Class).public boolean isDelegateRegistered(Class<?> typeClass)
IdStrategyDelegate explicitly registered for the typeClass.isDelegateRegistered in class IdStrategypublic <T> HasDelegate<T> getDelegateWrapper(Class<? super T> typeClass)
IdStrategydelegate.getDelegateWrapper in class IdStrategypublic <T> Delegate<T> getDelegate(Class<? super T> typeClass)
IdStrategydelegate.getDelegate in class IdStrategypublic boolean isRegistered(Class<?> typeClass)
IdStrategytypeClass is explicitly registered.isRegistered in class IdStrategypublic <T> HasSchema<T> getSchemaWrapper(Class<T> typeClass, boolean create)
IdStrategyschema wrapper. The caller is responsible that the typeClass is a pojo (e.g not an
enum/array/etc).getSchemaWrapper in class IdStrategyprotected EnumIO<? extends Enum<?>> getEnumIO(Class<?> enumClass)
IdStrategyEnumIO. The callers (internal field factories) are responsible that the class provided is an
enum class.getEnumIO in class IdStrategyprotected CollectionSchema.MessageFactory getCollectionFactory(Class<?> clazz)
IdStrategyCollectionSchema.MessageFactory. The callers (internal field factories) are responsible that
the class provided implements Collection.getCollectionFactory in class IdStrategyprotected MapSchema.MessageFactory getMapFactory(Class<?> clazz)
IdStrategyMapSchema.MessageFactory. The callers (internal field factories}) are responsible that the
class provided implements Map.getMapFactory in class IdStrategyprotected void writeCollectionIdTo(Output output, int fieldNumber, Class<?> clazz) throws IOException
writeCollectionIdTo in class IdStrategyIOExceptionprotected void transferCollectionId(Input input, Output output, int fieldNumber) throws IOException
transferCollectionId in class IdStrategyIOExceptionprotected CollectionSchema.MessageFactory resolveCollectionFrom(Input input) throws IOException
resolveCollectionFrom in class IdStrategyIOExceptionprotected void writeMapIdTo(Output output, int fieldNumber, Class<?> clazz) throws IOException
writeMapIdTo in class IdStrategyIOExceptionprotected void transferMapId(Input input, Output output, int fieldNumber) throws IOException
transferMapId in class IdStrategyIOExceptionprotected MapSchema.MessageFactory resolveMapFrom(Input input) throws IOException
resolveMapFrom in class IdStrategyIOExceptionprotected void writeEnumIdTo(Output output, int fieldNumber, Class<?> clazz) throws IOException
writeEnumIdTo in class IdStrategyIOExceptionprotected void transferEnumId(Input input, Output output, int fieldNumber) throws IOException
transferEnumId in class IdStrategyIOExceptionprotected EnumIO<?> resolveEnumFrom(Input input) throws IOException
resolveEnumFrom in class IdStrategyIOExceptionprotected <T> HasDelegate<T> tryWriteDelegateIdTo(Output output, int fieldNumber, Class<T> clazz) throws IOException
IdStrategytryWriteDelegateIdTo in class IdStrategyIOExceptionprotected <T> HasDelegate<T> transferDelegateId(Input input, Output output, int fieldNumber) throws IOException
transferDelegateId in class IdStrategyIOExceptionprotected <T> HasDelegate<T> resolveDelegateFrom(Input input) throws IOException
resolveDelegateFrom in class IdStrategyIOExceptionprotected <T> HasSchema<T> tryWritePojoIdTo(Output output, int fieldNumber, Class<T> clazz, boolean registered) throws IOException
tryWritePojoIdTo in class IdStrategyIOExceptionprotected <T> HasSchema<T> writePojoIdTo(Output output, int fieldNumber, Class<T> clazz) throws IOException
writePojoIdTo in class IdStrategyIOExceptionprotected <T> HasSchema<T> transferPojoId(Input input, Output output, int fieldNumber) throws IOException
transferPojoId in class IdStrategyIOExceptionprotected <T> HasSchema<T> resolvePojoFrom(Input input, int fieldNumber) throws IOException
resolvePojoFrom in class IdStrategyIOExceptionprotected <T> Schema<T> writeMessageIdTo(Output output, int fieldNumber, Message<T> message) throws IOException
writeMessageIdTo in class IdStrategyIOExceptionprotected void writeArrayIdTo(Output output, Class<?> componentType) throws IOException
writeArrayIdTo in class IdStrategyIOExceptionprotected void transferArrayId(Input input, Output output, int fieldNumber, boolean mapped) throws IOException
transferArrayId in class IdStrategyIOExceptionprotected Class<?> resolveArrayComponentTypeFrom(Input input, boolean mapped) throws IOException
resolveArrayComponentTypeFrom in class IdStrategyIOExceptionprotected void writeClassIdTo(Output output, Class<?> componentType, boolean array) throws IOException
writeClassIdTo in class IdStrategyIOExceptionprotected void transferClassId(Input input, Output output, int fieldNumber, boolean mapped, boolean array) throws IOException
transferClassId in class IdStrategyIOExceptionprotected Class<?> resolveClassFrom(Input input, boolean mapped, boolean array) throws IOException
resolveClassFrom in class IdStrategyIOExceptionCopyright © 2009–2020. All rights reserved.