Package io.protostuff.runtime
Class PolymorphicMapSchema
- java.lang.Object
-
- io.protostuff.runtime.PolymorphicSchema
-
- io.protostuff.runtime.PolymorphicMapSchema
-
- All Implemented Interfaces:
Schema<java.lang.Object>
public abstract class PolymorphicMapSchema extends PolymorphicSchema
Used when the type is an interface (Map/SortedMap).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.protostuff.runtime.PolymorphicSchema
PolymorphicSchema.Factory, PolymorphicSchema.Handler
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.IdentityHashMap<java.lang.Class<?>,java.lang.Integer>__nonPublicMaps(package private) static java.lang.reflect.FieldfCheckedMap_keyType(package private) static java.lang.reflect.FieldfCheckedMap_m(package private) static java.lang.reflect.FieldfCheckedMap_valueType(package private) static java.lang.reflect.FieldfCheckedSortedMap_sm(package private) static java.lang.reflect.FieldfSingletonMap_k(package private) static java.lang.reflect.FieldfSingletonMap_v(package private) static java.lang.reflect.FieldfSynchronizedMap_m(package private) static java.lang.reflect.FieldfSynchronizedMap_mutex(package private) static java.lang.reflect.FieldfSynchronizedSortedMap_sm(package private) static java.lang.reflect.FieldfUnmodifiableMap_m(package private) static java.lang.reflect.FieldfUnmodifiableSortedMap_sm(package private) static RuntimeEnv.Instantiator<?>iCheckedMap(package private) static RuntimeEnv.Instantiator<?>iCheckedSortedMap(package private) static intID_CHECKED_MAP(package private) static intID_CHECKED_SORTED_MAP(package private) static intID_EMPTY_MAP(package private) static intID_SINGLETON_MAP(package private) static intID_SYNCHRONIZED_MAP(package private) static intID_SYNCHRONIZED_SORTED_MAP(package private) static intID_UNMODIFIABLE_MAP(package private) static intID_UNMODIFIABLE_SORTED_MAP(package private) static RuntimeEnv.Instantiator<?>iSingletonMap(package private) static RuntimeEnv.Instantiator<?>iSynchronizedMap(package private) static RuntimeEnv.Instantiator<?>iSynchronizedSortedMap(package private) static RuntimeEnv.Instantiator<?>iUnmodifiableMap(package private) static RuntimeEnv.Instantiator<?>iUnmodifiableSortedMapprotected Pipe.Schema<java.lang.Object>pipeSchema(package private) static java.lang.StringSTR_CHECKED_MAP(package private) static java.lang.StringSTR_CHECKED_SORTED_MAP(package private) static java.lang.StringSTR_EMPTY_MAP(package private) static java.lang.StringSTR_SINGLETON_MAP(package private) static java.lang.StringSTR_SYNCHRONIZED_MAP(package private) static java.lang.StringSTR_SYNCHRONIZED_SORTED_MAP(package private) static java.lang.StringSTR_UNMODIFIABLE_MAP(package private) static java.lang.StringSTR_UNMODIFIABLE_SORTED_MAP-
Fields inherited from class io.protostuff.runtime.PolymorphicSchema
strategy
-
-
Constructor Summary
Constructors Constructor Description PolymorphicMapSchema(IdStrategy strategy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.ObjectfillSingletonMapFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, boolean graph, java.lang.Object map)Return true tojava.lang.StringgetFieldName(int number)Gets the field name associated with the number.intgetFieldNumber(java.lang.String name)Gets the field number associated with the name.Pipe.Schema<java.lang.Object>getPipeSchema()The pipe schema associated with this schema.(package private) static intidFrom(java.lang.Class<?> clazz)(package private) static java.lang.ObjectinstanceFrom(int id)private static java.lang.Class<?>map(java.lang.String className, int id)voidmergeFrom(Input input, java.lang.Object owner)Deserializes a message/object from theinput.java.lang.StringmessageFullName()Returns the full name of the message tied to this schema.java.lang.StringmessageName()Returns the simple name of the message tied to this schema.(package private) static java.lang.Stringname(int number)(package private) static intnumber(char c)(package private) static intnumber(java.lang.String name)private static java.lang.ObjectreadCheckedMapFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, boolean graph, java.lang.Object map, boolean sm)(package private) static java.lang.ObjectreadObjectFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy)(package private) static java.lang.ObjectreadObjectFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, int number)private static java.lang.ObjectreadSynchronizedMapFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, boolean graph, java.lang.Object map, boolean sm)private static java.lang.ObjectreadUnmodifiableMapFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, boolean graph, java.lang.Object map, boolean sm)(package private) static voidtransferObject(Pipe.Schema<java.lang.Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy)(package private) static voidtransferObject(Pipe.Schema<java.lang.Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy, int number)(package private) static voidtransferSingletonMap(Pipe.Schema<java.lang.Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy)private static voidwriteCheckedMapTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy, int id)(package private) static voidwriteNonPublicMapTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy)(package private) static voidwriteObjectTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy)private static voidwriteSynchronizedMapTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy, int id)voidwriteTo(Output output, java.lang.Object value)Serializes a message/object to theoutput.private static voidwriteUnmodifiableMapTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy, int id)-
Methods inherited from class io.protostuff.runtime.PolymorphicSchema
isInitialized, newMessage, setValue, typeClass
-
-
-
-
Field Detail
-
ID_EMPTY_MAP
static final int ID_EMPTY_MAP
- See Also:
- Constant Field Values
-
ID_SINGLETON_MAP
static final int ID_SINGLETON_MAP
- See Also:
- Constant Field Values
-
ID_UNMODIFIABLE_MAP
static final int ID_UNMODIFIABLE_MAP
- See Also:
- Constant Field Values
-
ID_UNMODIFIABLE_SORTED_MAP
static final int ID_UNMODIFIABLE_SORTED_MAP
- See Also:
- Constant Field Values
-
ID_SYNCHRONIZED_MAP
static final int ID_SYNCHRONIZED_MAP
- See Also:
- Constant Field Values
-
ID_SYNCHRONIZED_SORTED_MAP
static final int ID_SYNCHRONIZED_SORTED_MAP
- See Also:
- Constant Field Values
-
ID_CHECKED_MAP
static final int ID_CHECKED_MAP
- See Also:
- Constant Field Values
-
ID_CHECKED_SORTED_MAP
static final int ID_CHECKED_SORTED_MAP
- See Also:
- Constant Field Values
-
STR_EMPTY_MAP
static final java.lang.String STR_EMPTY_MAP
- See Also:
- Constant Field Values
-
STR_SINGLETON_MAP
static final java.lang.String STR_SINGLETON_MAP
- See Also:
- Constant Field Values
-
STR_UNMODIFIABLE_MAP
static final java.lang.String STR_UNMODIFIABLE_MAP
- See Also:
- Constant Field Values
-
STR_UNMODIFIABLE_SORTED_MAP
static final java.lang.String STR_UNMODIFIABLE_SORTED_MAP
- See Also:
- Constant Field Values
-
STR_SYNCHRONIZED_MAP
static final java.lang.String STR_SYNCHRONIZED_MAP
- See Also:
- Constant Field Values
-
STR_SYNCHRONIZED_SORTED_MAP
static final java.lang.String STR_SYNCHRONIZED_SORTED_MAP
- See Also:
- Constant Field Values
-
STR_CHECKED_MAP
static final java.lang.String STR_CHECKED_MAP
- See Also:
- Constant Field Values
-
STR_CHECKED_SORTED_MAP
static final java.lang.String STR_CHECKED_SORTED_MAP
- See Also:
- Constant Field Values
-
__nonPublicMaps
static final java.util.IdentityHashMap<java.lang.Class<?>,java.lang.Integer> __nonPublicMaps
-
fSingletonMap_k
static final java.lang.reflect.Field fSingletonMap_k
-
fSingletonMap_v
static final java.lang.reflect.Field fSingletonMap_v
-
fUnmodifiableMap_m
static final java.lang.reflect.Field fUnmodifiableMap_m
-
fUnmodifiableSortedMap_sm
static final java.lang.reflect.Field fUnmodifiableSortedMap_sm
-
fSynchronizedMap_m
static final java.lang.reflect.Field fSynchronizedMap_m
-
fSynchronizedSortedMap_sm
static final java.lang.reflect.Field fSynchronizedSortedMap_sm
-
fSynchronizedMap_mutex
static final java.lang.reflect.Field fSynchronizedMap_mutex
-
fCheckedMap_m
static final java.lang.reflect.Field fCheckedMap_m
-
fCheckedSortedMap_sm
static final java.lang.reflect.Field fCheckedSortedMap_sm
-
fCheckedMap_keyType
static final java.lang.reflect.Field fCheckedMap_keyType
-
fCheckedMap_valueType
static final java.lang.reflect.Field fCheckedMap_valueType
-
iSingletonMap
static final RuntimeEnv.Instantiator<?> iSingletonMap
-
iUnmodifiableMap
static final RuntimeEnv.Instantiator<?> iUnmodifiableMap
-
iUnmodifiableSortedMap
static final RuntimeEnv.Instantiator<?> iUnmodifiableSortedMap
-
iSynchronizedMap
static final RuntimeEnv.Instantiator<?> iSynchronizedMap
-
iSynchronizedSortedMap
static final RuntimeEnv.Instantiator<?> iSynchronizedSortedMap
-
iCheckedMap
static final RuntimeEnv.Instantiator<?> iCheckedMap
-
iCheckedSortedMap
static final RuntimeEnv.Instantiator<?> iCheckedSortedMap
-
pipeSchema
protected final Pipe.Schema<java.lang.Object> pipeSchema
-
-
Constructor Detail
-
PolymorphicMapSchema
public PolymorphicMapSchema(IdStrategy strategy)
-
-
Method Detail
-
map
private static java.lang.Class<?> map(java.lang.String className, int id)
-
name
static java.lang.String name(int number)
-
number
static int number(java.lang.String name)
-
number
static int number(char c)
-
getPipeSchema
public Pipe.Schema<java.lang.Object> getPipeSchema()
Description copied from class:PolymorphicSchemaThe pipe schema associated with this schema.- Specified by:
getPipeSchemain classPolymorphicSchema
-
getFieldName
public java.lang.String getFieldName(int number)
Description copied from interface:SchemaGets the field name associated with the number. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:return String.valueOf(number);
-
getFieldNumber
public int getFieldNumber(java.lang.String name)
Description copied from interface:SchemaGets the field number associated with the name. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:return Integer.parseInt(name);
-
messageFullName
public java.lang.String messageFullName()
Description copied from interface:SchemaReturns the full name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getName();
-
messageName
public java.lang.String messageName()
Description copied from interface:SchemaReturns the simple name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getSimpleName();
-
mergeFrom
public void mergeFrom(Input input, java.lang.Object owner) throws java.io.IOException
Description copied from interface:SchemaDeserializes a message/object from theinput.- Throws:
java.io.IOException
-
writeTo
public void writeTo(Output output, java.lang.Object value) throws java.io.IOException
Description copied from interface:SchemaSerializes a message/object to theoutput.- Throws:
java.io.IOException
-
idFrom
static int idFrom(java.lang.Class<?> clazz)
-
instanceFrom
static java.lang.Object instanceFrom(int id)
-
writeObjectTo
static void writeObjectTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy) throws java.io.IOException
- Throws:
java.io.IOException
-
writeNonPublicMapTo
static void writeNonPublicMapTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy) throws java.io.IOException
- Throws:
java.io.IOException
-
writeUnmodifiableMapTo
private static void writeUnmodifiableMapTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy, int id) throws java.io.IOException
- Throws:
java.io.IOException
-
writeSynchronizedMapTo
private static void writeSynchronizedMapTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy, int id) throws java.io.IOException
- Throws:
java.io.IOException
-
writeCheckedMapTo
private static void writeCheckedMapTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy, int id) throws java.io.IOException
- Throws:
java.io.IOException
-
readObjectFrom
static java.lang.Object readObjectFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy) throws java.io.IOException
- Throws:
java.io.IOException
-
readObjectFrom
static java.lang.Object readObjectFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, int number) throws java.io.IOException
- Throws:
java.io.IOException
-
fillSingletonMapFrom
private static java.lang.Object fillSingletonMapFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, boolean graph, java.lang.Object map) throws java.io.IOException
Return true to- Throws:
java.io.IOException
-
readUnmodifiableMapFrom
private static java.lang.Object readUnmodifiableMapFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, boolean graph, java.lang.Object map, boolean sm) throws java.io.IOException
- Throws:
java.io.IOException
-
readSynchronizedMapFrom
private static java.lang.Object readSynchronizedMapFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, boolean graph, java.lang.Object map, boolean sm) throws java.io.IOException
- Throws:
java.io.IOException
-
readCheckedMapFrom
private static java.lang.Object readCheckedMapFrom(Input input, Schema<?> schema, java.lang.Object owner, IdStrategy strategy, boolean graph, java.lang.Object map, boolean sm) throws java.io.IOException
- Throws:
java.io.IOException
-
transferObject
static void transferObject(Pipe.Schema<java.lang.Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy) throws java.io.IOException
- Throws:
java.io.IOException
-
transferObject
static void transferObject(Pipe.Schema<java.lang.Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy, int number) throws java.io.IOException
- Throws:
java.io.IOException
-
transferSingletonMap
static void transferSingletonMap(Pipe.Schema<java.lang.Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy) throws java.io.IOException
- Throws:
java.io.IOException
-
-