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>
pipeSchema
This pipe schema delegates to another schema derived from the input.IdStrategy
strategy
-
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 void
doMergeFrom(Input input, Schema<java.lang.Object> derivedSchema, java.lang.Object owner)
java.lang.String
getFieldName(int number)
Gets the field name associated with the number.int
getFieldNumber(java.lang.String name)
Gets the field number associated with the name.boolean
isInitialized(java.lang.Object owner)
Returns true if there is no required field or if all the required fields are set.void
mergeFrom(Input input, java.lang.Object owner)
Delegates to the schema derived from the input.java.lang.String
messageFullName()
Returns the full name of the message tied to this schema.java.lang.String
messageName()
Returns the simple name of the message tied to this schema.java.lang.Object
newMessage()
Creates the message/object tied to this schema.java.lang.Class<? super java.lang.Object>
typeClass()
Gets the class of the message.void
writeTo(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:Schema
Gets 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:
getFieldName
in interfaceSchema<java.lang.Object>
-
getFieldNumber
public int getFieldNumber(java.lang.String name)
Description copied from interface:Schema
Gets 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:
getFieldNumber
in interfaceSchema<java.lang.Object>
-
isInitialized
public boolean isInitialized(java.lang.Object owner)
Description copied from interface:Schema
Returns true if there is no required field or if all the required fields are set.- Specified by:
isInitialized
in interfaceSchema<java.lang.Object>
-
messageFullName
public java.lang.String messageFullName()
Description copied from interface:Schema
Returns the full name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getName();- Specified by:
messageFullName
in interfaceSchema<java.lang.Object>
-
messageName
public java.lang.String messageName()
Description copied from interface:Schema
Returns the simple name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getSimpleName();- Specified by:
messageName
in interfaceSchema<java.lang.Object>
-
newMessage
public java.lang.Object newMessage()
Description copied from interface:Schema
Creates the message/object tied to this schema.- Specified by:
newMessage
in interfaceSchema<java.lang.Object>
-
typeClass
public java.lang.Class<? super java.lang.Object> typeClass()
Description copied from interface:Schema
Gets 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. Theowner
owns 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
.
-
-