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 classNumericIdStrategy.RegisteredDelegate<T>static interfaceNumericIdStrategy.RegistryRegister 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 intCID_BIGDECIMALprotected static intCID_BIGINTEGERprotected static intCID_BOOLprotected static intCID_BYTEprotected static intCID_BYTE_ARRAYprotected static intCID_BYTESprotected static intCID_CHARprotected static intCID_CLASSprotected static intCID_COLLECTIONprotected static intCID_DATEprotected static intCID_DELEGATEprotected static intCID_DOUBLEprotected static intCID_ENUMprotected static intCID_ENUM_MAPprotected static intCID_ENUM_SETprotected static intCID_FLOATprotected static intCID_INT32protected static intCID_INT64protected static intCID_MAPprotected static intCID_OBJECTprotected static intCID_POJOprotected static intCID_SHORTprotected static intCID_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 protectedNumericIdStrategy(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 intgetEnumId(java.lang.Class<?> clazz)protected abstract intgetId(java.lang.Class<?> clazz)private static intgetPrimitiveOrScalarId(java.lang.Class<?> clazz, int id)protected abstract NumericIdStrategy.RegisteredDelegate<?>getRegisteredDelegate(java.lang.Class<?> clazz)protected static <T> voidgrow(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 voidtransferArrayId(Input input, Output output, int fieldNumber, boolean mapped)protected voidtransferClassId(Input input, Output output, int fieldNumber, boolean mapped, boolean array)protected voidwriteArrayIdTo(Output output, java.lang.Class<?> componentType)protected voidwriteClassIdTo(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:
writeArrayIdToin classIdStrategy- Throws:
java.io.IOException
-
transferArrayId
protected void transferArrayId(Input input, Output output, int fieldNumber, boolean mapped) throws java.io.IOException
- Specified by:
transferArrayIdin classIdStrategy- Throws:
java.io.IOException
-
resolveArrayComponentTypeFrom
protected java.lang.Class<?> resolveArrayComponentTypeFrom(Input input, boolean mapped) throws java.io.IOException
- Specified by:
resolveArrayComponentTypeFromin classIdStrategy- Throws:
java.io.IOException
-
writeClassIdTo
protected void writeClassIdTo(Output output, java.lang.Class<?> componentType, boolean array) throws java.io.IOException
- Specified by:
writeClassIdToin 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:
transferClassIdin classIdStrategy- Throws:
java.io.IOException
-
resolveClassFrom
protected java.lang.Class<?> resolveClassFrom(Input input, boolean mapped, boolean array) throws java.io.IOException
- Specified by:
resolveClassFromin 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)
-
-