Package io.protostuff.runtime
Class NumericIdStrategy
- java.lang.Object
-
- io.protostuff.runtime.IdStrategy
-
- io.protostuff.runtime.NumericIdStrategy
-
- Direct Known Subclasses:
ExplicitIdStrategy
,IncrementalIdStrategy
public abstract class NumericIdStrategy extends IdStrategy
Base class for numeric id strategies.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
NumericIdStrategy.RegisteredDelegate<T>
static interface
NumericIdStrategy.Registry
Register your pojos/enums/collections/maps/delegates here.-
Nested classes/interfaces inherited from class io.protostuff.runtime.IdStrategy
IdStrategy.Factory, IdStrategy.UnknownTypeException, IdStrategy.Wrapper
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
CID_BIGDECIMAL
protected static int
CID_BIGINTEGER
protected static int
CID_BOOL
protected static int
CID_BYTE
protected static int
CID_BYTE_ARRAY
protected static int
CID_BYTES
protected static int
CID_CHAR
protected static int
CID_CLASS
protected static int
CID_COLLECTION
protected static int
CID_DATE
protected static int
CID_DELEGATE
protected static int
CID_DOUBLE
protected static int
CID_ENUM
protected static int
CID_ENUM_MAP
protected static int
CID_ENUM_SET
protected static int
CID_FLOAT
protected static int
CID_INT32
protected static int
CID_INT64
protected static int
CID_MAP
protected static int
CID_OBJECT
protected static int
CID_POJO
protected static int
CID_SHORT
protected static int
CID_STRING
-
Fields inherited from class io.protostuff.runtime.IdStrategy
ARRAY_BIGDECIMAL_SCHEMA, ARRAY_BIGINTEGER_SCHEMA, ARRAY_BOOL_BOXED_SCHEMA, ARRAY_BOOL_DERIVED_SCHEMA, ARRAY_BOOL_PRIMITIVE_SCHEMA, ARRAY_BYTEARRAY_SCHEMA, ARRAY_BYTESTRING_SCHEMA, ARRAY_CHAR_BOXED_SCHEMA, ARRAY_CHAR_DERIVED_SCHEMA, ARRAY_CHAR_PRIMITIVE_SCHEMA, ARRAY_DATE_SCHEMA, ARRAY_DOUBLE_BOXED_SCHEMA, ARRAY_DOUBLE_DERIVED_SCHEMA, ARRAY_DOUBLE_PRIMITIVE_SCHEMA, ARRAY_ELEMENT_SCHEMA, ARRAY_FLOAT_BOXED_SCHEMA, ARRAY_FLOAT_DERIVED_SCHEMA, ARRAY_FLOAT_PRIMITIVE_SCHEMA, ARRAY_INT32_BOXED_SCHEMA, ARRAY_INT32_DERIVED_SCHEMA, ARRAY_INT32_PRIMITIVE_SCHEMA, ARRAY_INT64_BOXED_SCHEMA, ARRAY_INT64_DERIVED_SCHEMA, ARRAY_INT64_PRIMITIVE_SCHEMA, ARRAY_PIPE_SCHEMA, ARRAY_SCHEMA, ARRAY_SHORT_BOXED_SCHEMA, ARRAY_SHORT_DERIVED_SCHEMA, ARRAY_SHORT_PRIMITIVE_SCHEMA, ARRAY_STRING_SCHEMA, AUTO_LOAD_POLYMORPHIC_CLASSES, CLASS_ELEMENT_SCHEMA, CLASS_PIPE_SCHEMA, CLASS_SCHEMA, COLLECTION_PIPE_SCHEMA, COLLECTION_SCHEMA, COLLECTION_SCHEMA_ON_REPEATED_FIELDS, DEFAULT_FLAGS, DYNAMIC_VALUE_PIPE_SCHEMA, DYNAMIC_VALUE_SCHEMA, ENTRY_PIPE_SCHEMA, ENTRY_SCHEMA, ENUMS_BY_NAME, flags, groupId, MAP_PIPE_SCHEMA, MAP_SCHEMA, MORPH_COLLECTION_INTERFACES, MORPH_MAP_INTERFACES, MORPH_NON_FINAL_POJOS, NUMBER_ELEMENT_SCHEMA, OBJECT_ELEMENT_SCHEMA, OBJECT_PIPE_SCHEMA, OBJECT_SCHEMA, POJO_SCHEMA_ON_COLLECTION_FIELDS, POJO_SCHEMA_ON_MAP_FIELDS, POLYMORPHIC_COLLECTION_PIPE_SCHEMA, POLYMORPHIC_COLLECTION_SCHEMA, POLYMORPHIC_ENUM_ELEMENT_SCHEMA, POLYMORPHIC_MAP_PIPE_SCHEMA, POLYMORPHIC_MAP_SCHEMA, POLYMORPHIC_POJO_ELEMENT_SCHEMA, POLYMORPHIC_THROWABLE_ELEMENT_SCHEMA, PRESERVE_NULL_ELEMENTS, preserveNull, primaryGroup
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NumericIdStrategy(int flags, IdStrategy primaryGroup, int groupId)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.Class<?>
collectionClass(int id)
protected abstract java.lang.Class<?>
delegateClass(int id)
protected abstract java.lang.Class<?>
enumClass(int id)
protected abstract int
getEnumId(java.lang.Class<?> clazz)
protected abstract int
getId(java.lang.Class<?> clazz)
private static int
getPrimitiveOrScalarId(java.lang.Class<?> clazz, int id)
protected abstract NumericIdStrategy.RegisteredDelegate<?>
getRegisteredDelegate(java.lang.Class<?> clazz)
protected static <T> void
grow(java.util.ArrayList<T> list, int size)
protected abstract java.lang.Class<?>
mapClass(int id)
protected static <T> java.util.ArrayList<T>
newList(int size)
protected abstract java.lang.Class<?>
pojoClass(int id)
protected java.lang.Class<?>
resolveArrayComponentTypeFrom(Input input, boolean mapped)
private java.lang.Class<?>
resolveClass(int id)
protected java.lang.Class<?>
resolveClassFrom(Input input, boolean mapped, boolean array)
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
writeArrayIdTo(Output output, java.lang.Class<?> componentType)
protected void
writeClassIdTo(Output output, java.lang.Class<?> componentType, boolean array)
-
Methods inherited from class io.protostuff.runtime.IdStrategy
createMessageInstance, getCollectionFactory, getDelegate, getDelegateWrapper, getEnumIO, getMapFactory, getSchemaWrapper, isDelegateRegistered, isRegistered, newSchema, resolveCollectionFrom, resolveDelegateFrom, resolveEnumFrom, resolveMapFrom, resolvePojoFrom, transferCollectionId, transferDelegateId, transferEnumId, transferMapId, transferPojoId, tryWriteDelegateIdTo, tryWritePojoIdTo, writeCollectionIdTo, writeEnumIdTo, writeMapIdTo, writeMessageIdTo, writePojoIdTo
-
-
-
-
Field Detail
-
CID_BOOL
protected static final int CID_BOOL
- See Also:
- Constant Field Values
-
CID_BYTE
protected static final int CID_BYTE
- See Also:
- Constant Field Values
-
CID_CHAR
protected static final int CID_CHAR
- See Also:
- Constant Field Values
-
CID_SHORT
protected static final int CID_SHORT
- See Also:
- Constant Field Values
-
CID_INT32
protected static final int CID_INT32
- See Also:
- Constant Field Values
-
CID_INT64
protected static final int CID_INT64
- See Also:
- Constant Field Values
-
CID_FLOAT
protected static final int CID_FLOAT
- See Also:
- Constant Field Values
-
CID_DOUBLE
protected static final int CID_DOUBLE
- See Also:
- Constant Field Values
-
CID_STRING
protected static final int CID_STRING
- See Also:
- Constant Field Values
-
CID_BYTES
protected static final int CID_BYTES
- See Also:
- Constant Field Values
-
CID_BYTE_ARRAY
protected static final int CID_BYTE_ARRAY
- See Also:
- Constant Field Values
-
CID_BIGDECIMAL
protected static final int CID_BIGDECIMAL
- See Also:
- Constant Field Values
-
CID_BIGINTEGER
protected static final int CID_BIGINTEGER
- See Also:
- Constant Field Values
-
CID_DATE
protected static final int CID_DATE
- See Also:
- Constant Field Values
-
CID_OBJECT
protected static final int CID_OBJECT
- See Also:
- Constant Field Values
-
CID_ENUM_SET
protected static final int CID_ENUM_SET
- See Also:
- Constant Field Values
-
CID_ENUM_MAP
protected static final int CID_ENUM_MAP
- See Also:
- Constant Field Values
-
CID_ENUM
protected static final int CID_ENUM
- See Also:
- Constant Field Values
-
CID_COLLECTION
protected static final int CID_COLLECTION
- See Also:
- Constant Field Values
-
CID_MAP
protected static final int CID_MAP
- See Also:
- Constant Field Values
-
CID_POJO
protected static final int CID_POJO
- See Also:
- Constant Field Values
-
CID_CLASS
protected static final int CID_CLASS
- See Also:
- Constant Field Values
-
CID_DELEGATE
protected static final int CID_DELEGATE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NumericIdStrategy
protected NumericIdStrategy(int flags, IdStrategy primaryGroup, int groupId)
-
-
Method Detail
-
writeArrayIdTo
protected void writeArrayIdTo(Output output, java.lang.Class<?> componentType) throws java.io.IOException
- Specified by:
writeArrayIdTo
in classIdStrategy
- Throws:
java.io.IOException
-
transferArrayId
protected void transferArrayId(Input input, Output output, int fieldNumber, boolean mapped) throws java.io.IOException
- Specified by:
transferArrayId
in classIdStrategy
- Throws:
java.io.IOException
-
resolveArrayComponentTypeFrom
protected java.lang.Class<?> resolveArrayComponentTypeFrom(Input input, boolean mapped) throws java.io.IOException
- Specified by:
resolveArrayComponentTypeFrom
in classIdStrategy
- Throws:
java.io.IOException
-
writeClassIdTo
protected void writeClassIdTo(Output output, java.lang.Class<?> componentType, boolean array) throws java.io.IOException
- Specified by:
writeClassIdTo
in classIdStrategy
- Throws:
java.io.IOException
-
transferClassId
protected void transferClassId(Input input, Output output, int fieldNumber, boolean mapped, boolean array) throws java.io.IOException
- Specified by:
transferClassId
in classIdStrategy
- Throws:
java.io.IOException
-
resolveClassFrom
protected java.lang.Class<?> resolveClassFrom(Input input, boolean mapped, boolean array) throws java.io.IOException
- Specified by:
resolveClassFrom
in classIdStrategy
- Throws:
java.io.IOException
-
getPrimitiveOrScalarId
private static int getPrimitiveOrScalarId(java.lang.Class<?> clazz, int id)
-
resolveClass
private java.lang.Class<?> resolveClass(int id)
-
getRegisteredDelegate
protected abstract NumericIdStrategy.RegisteredDelegate<?> getRegisteredDelegate(java.lang.Class<?> clazz)
-
enumClass
protected abstract java.lang.Class<?> enumClass(int id)
-
delegateClass
protected abstract java.lang.Class<?> delegateClass(int id)
-
collectionClass
protected abstract java.lang.Class<?> collectionClass(int id)
-
mapClass
protected abstract java.lang.Class<?> mapClass(int id)
-
pojoClass
protected abstract java.lang.Class<?> pojoClass(int id)
-
getEnumId
protected abstract int getEnumId(java.lang.Class<?> clazz)
-
getId
protected abstract int getId(java.lang.Class<?> clazz)
-
newList
protected static <T> java.util.ArrayList<T> newList(int size)
-
grow
protected static <T> void grow(java.util.ArrayList<T> list, int size)
-
-