Package io.protostuff.runtime
Class PolymorphicPojoSchema
- java.lang.Object
-
- io.protostuff.runtime.PolymorphicSchema
-
- io.protostuff.runtime.PolymorphicPojoSchema
-
- All Implemented Interfaces:
Schema<java.lang.Object>
public abstract class PolymorphicPojoSchema extends PolymorphicSchema
Will be used if eitherRuntimeEnv.POJO_SCHEMA_ON_COLLECTION_FIELDSorRuntimeEnv.POJO_SCHEMA_ON_MAP_FIELDSis set. Applies to a field which is an interface and the type is assignable from Collection or Map.
-
-
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 protected Pipe.Schema<java.lang.Object>pipeSchema-
Fields inherited from class io.protostuff.runtime.PolymorphicSchema
strategy
-
-
Constructor Summary
Constructors Constructor Description PolymorphicPojoSchema(IdStrategy strategy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.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.booleanisInitialized(java.lang.Object owner)Returns true if there is no required field or if all the required fields are set.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.java.lang.ObjectnewMessage()Creates the message/object tied to this schema.(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)(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)java.lang.Class<? super java.lang.Object>typeClass()Gets the class of the message.(package private) static voidwriteObjectTo(Output output, java.lang.Object value, Schema<?> currentSchema, IdStrategy strategy)voidwriteTo(Output output, java.lang.Object value)Serializes a message/object to theoutput.-
Methods inherited from class io.protostuff.runtime.PolymorphicSchema
setValue
-
-
-
-
Field Detail
-
pipeSchema
protected final Pipe.Schema<java.lang.Object> pipeSchema
-
-
Constructor Detail
-
PolymorphicPojoSchema
public PolymorphicPojoSchema(IdStrategy strategy)
-
-
Method Detail
-
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);
-
isInitialized
public boolean isInitialized(java.lang.Object owner)
Description copied from interface:SchemaReturns true if there is no required field or if all the required fields are set.- Specified by:
isInitializedin interfaceSchema<java.lang.Object>- Overrides:
isInitializedin classPolymorphicSchema
-
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();
-
newMessage
public java.lang.Object newMessage()
Description copied from interface:SchemaCreates the message/object tied to this schema.- Specified by:
newMessagein interfaceSchema<java.lang.Object>- Overrides:
newMessagein classPolymorphicSchema
-
typeClass
public java.lang.Class<? super java.lang.Object> typeClass()
Description copied from interface:SchemaGets the class of the message.- Specified by:
typeClassin interfaceSchema<java.lang.Object>- Overrides:
typeClassin classPolymorphicSchema
-
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
-
writeObjectTo
static void writeObjectTo(Output output, java.lang.Object value, Schema<?> currentSchema, 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) 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
-
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
-
-