Class RuntimeDerivativeField<T>


  • abstract class RuntimeDerivativeField<T>
    extends Field<T>
    A runtime field w/c represents an abstract class, interface or a base type with many possible subclasses.

    The type metadata is written for the deserializer to know the actual/exact schema to use upon deserialization.

    Limitations: The number of fields are limited to 126 (127 is the usual limit anyway). The order of the fields being written must be preserved. It will not work if the message serialized is coming from the browser since the fields will most likey be out-of-order (unless you have control of the json serialization).

    • Field Detail

      • schema

        public final DerivativeSchema schema
        The schema of the polymorphic pojo.
      • typeClass

        public final java.lang.Class<java.lang.Object> typeClass
        The class of the message field.
    • Constructor Detail

      • RuntimeDerivativeField

        public RuntimeDerivativeField​(java.lang.Class<java.lang.Object> typeClass,
                                      WireFormat.FieldType type,
                                      int number,
                                      java.lang.String name,
                                      boolean repeated,
                                      Tag tag,
                                      IdStrategy strategy)
    • Method Detail

      • doMergeFrom

        protected abstract void doMergeFrom​(Input input,
                                            Schema<java.lang.Object> derivedSchema,
                                            java.lang.Object owner)
                                     throws java.io.IOException
        Throws:
        java.io.IOException