Class DerivativeSchema

java.lang.Object
io.protostuff.runtime.DerivativeSchema
All Implemented Interfaces:
Schema<Object>

public abstract class DerivativeSchema extends Object implements Schema<Object>
This schema delegates to another schema derived from the input.
  • Field Details

    • strategy

      public final IdStrategy strategy
    • pipeSchema

      public final Pipe.Schema<Object> pipeSchema
      This pipe schema delegates to another schema derived from the input.
  • Constructor Details

    • DerivativeSchema

      public DerivativeSchema(IdStrategy strategy)
  • Method Details

    • getFieldName

      public 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 interface Schema<Object>
    • getFieldNumber

      public int getFieldNumber(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 interface Schema<Object>
    • isInitialized

      public boolean isInitialized(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 interface Schema<Object>
    • messageFullName

      public 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 interface Schema<Object>
    • messageName

      public 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 interface Schema<Object>
    • newMessage

      public Object newMessage()
      Description copied from interface: Schema
      Creates the message/object tied to this schema.
      Specified by:
      newMessage in interface Schema<Object>
    • typeClass

      public Class<? super Object> typeClass()
      Description copied from interface: Schema
      Gets the class of the message.
      Specified by:
      typeClass in interface Schema<Object>
    • mergeFrom

      public void mergeFrom(Input input, Object owner) throws IOException
      Delegates to the schema derived from the input. The owner owns the message (polymorphic) that is tied to this schema.
      Specified by:
      mergeFrom in interface Schema<Object>
      Throws:
      IOException
    • writeTo

      public void writeTo(Output output, Object value) throws IOException
      Delegates to the schema derived from the value.
      Specified by:
      writeTo in interface Schema<Object>
      Throws:
      IOException
    • doMergeFrom

      protected abstract void doMergeFrom(Input input, Schema<Object> derivedSchema, Object owner) throws IOException
      Throws:
      IOException