Package io.protostuff.runtime
Class DerivativeSchema
- java.lang.Object
-
- io.protostuff.runtime.DerivativeSchema
-
-
Field Summary
Fields Modifier and Type Field Description Pipe.Schema<java.lang.Object>pipeSchemaThis pipe schema delegates to another schema derived from the input.IdStrategystrategy
-
Constructor Summary
Constructors Constructor Description DerivativeSchema(IdStrategy strategy)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoMergeFrom(Input input, Schema<java.lang.Object> derivedSchema, java.lang.Object owner)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.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)Delegates to the schema derived from the input.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.java.lang.Class<? super java.lang.Object>typeClass()Gets the class of the message.voidwriteTo(Output output, java.lang.Object value)Delegates to the schema derived from thevalue.
-
-
-
Field Detail
-
strategy
public final IdStrategy strategy
-
pipeSchema
public final Pipe.Schema<java.lang.Object> pipeSchema
This pipe schema delegates to another schema derived from the input.
-
-
Constructor Detail
-
DerivativeSchema
public DerivativeSchema(IdStrategy strategy)
-
-
Method Detail
-
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);
- Specified by:
getFieldNamein interfaceSchema<java.lang.Object>
-
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);
- Specified by:
getFieldNumberin interfaceSchema<java.lang.Object>
-
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>
-
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();- Specified by:
messageFullNamein interfaceSchema<java.lang.Object>
-
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();- Specified by:
messageNamein interfaceSchema<java.lang.Object>
-
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>
-
typeClass
public java.lang.Class<? super java.lang.Object> typeClass()
Description copied from interface:SchemaGets the class of the message.
-
mergeFrom
public void mergeFrom(Input input, java.lang.Object owner) throws java.io.IOException
Delegates to the schema derived from the input. Theownerowns the message (polymorphic) that is tied to this schema.
-
writeTo
public void writeTo(Output output, java.lang.Object value) throws java.io.IOException
Delegates to the schema derived from thevalue.
-
-