Class MessageSetSchema<T>

  • All Implemented Interfaces:
    Schema<T>

    @CheckReturnValue
    final class MessageSetSchema<T>
    extends java.lang.Object
    implements Schema<T>
    Schema used for proto2 messages using message_set_wireformat.
    • Field Detail

      • defaultInstance

        private final MessageLite defaultInstance
      • hasExtensions

        private final boolean hasExtensions
    • Method Detail

      • newInstance

        public T newInstance()
        Description copied from interface: Schema
        Creates a new instance of the message class.
        Specified by:
        newInstance in interface Schema<T>
      • equals

        public boolean equals​(T message,
                              T other)
        Description copied from interface: Schema
        Determine of the two messages are equal.
        Specified by:
        equals in interface Schema<T>
      • hashCode

        public int hashCode​(T message)
        Description copied from interface: Schema
        Compute a hashCode for the message.
        Specified by:
        hashCode in interface Schema<T>
      • mergeFrom

        public void mergeFrom​(T message,
                              T other)
        Description copied from interface: Schema
        Merge values from other into message. This method doesn't make the message immutable. To make the message immutable after merging, use Schema.makeImmutable(T).
        Specified by:
        mergeFrom in interface Schema<T>
      • writeTo

        public void writeTo​(T message,
                            Writer writer)
                     throws java.io.IOException
        Description copied from interface: Schema
        Writes the given message to the target Writer.
        Specified by:
        writeTo in interface Schema<T>
        Throws:
        java.io.IOException
      • writeUnknownFieldsHelper

        private <UT,​UB> void writeUnknownFieldsHelper​(UnknownFieldSchema<UT,​UB> unknownFieldSchema,
                                                            T message,
                                                            Writer writer)
                                                     throws java.io.IOException
        A helper method for wildcard capture of unknownFieldSchema. See: https://docs.oracle.com/javase/tutorial/java/generics/capture.html
        Throws:
        java.io.IOException
      • mergeFrom

        public void mergeFrom​(T message,
                              byte[] data,
                              int position,
                              int limit,
                              ArrayDecoders.Registers registers)
                       throws java.io.IOException
        Description copied from interface: Schema
        Like the above but parses from a byte[] without extensions. Entry point of fast path. Note that this method may throw IndexOutOfBoundsException if the input data is not valid protobuf wire format. Protobuf public API methods should catch and convert that exception to InvalidProtocolBufferException.
        Specified by:
        mergeFrom in interface Schema<T>
        Throws:
        java.io.IOException
      • mergeFrom

        public void mergeFrom​(T message,
                              Reader reader,
                              ExtensionRegistryLite extensionRegistry)
                       throws java.io.IOException
        Description copied from interface: Schema
        Reads fields from the given Reader and merges them into the message. It doesn't make the message immutable after parsing is done. To make the message immutable, use Schema.makeImmutable(T).
        Specified by:
        mergeFrom in interface Schema<T>
        Throws:
        java.io.IOException
      • mergeFromHelper

        private <UT,​UB,​ET extends FieldSet.FieldDescriptorLite<ET>> void mergeFromHelper​(UnknownFieldSchema<UT,​UB> unknownFieldSchema,
                                                                                                     ExtensionSchema<ET> extensionSchema,
                                                                                                     T message,
                                                                                                     Reader reader,
                                                                                                     ExtensionRegistryLite extensionRegistry)
                                                                                              throws java.io.IOException
        A helper method for wildcard capture of unknownFieldSchema. See: https://docs.oracle.com/javase/tutorial/java/generics/capture.html
        Throws:
        java.io.IOException
      • makeImmutable

        public void makeImmutable​(T message)
        Description copied from interface: Schema
        Marks repeated/map/extension/unknown fields as immutable.
        Specified by:
        makeImmutable in interface Schema<T>
      • isInitialized

        public final boolean isInitialized​(T message)
        Description copied from interface: Schema
        Checks whether all required fields are set.
        Specified by:
        isInitialized in interface Schema<T>
      • getSerializedSize

        public int getSerializedSize​(T message)
        Description copied from interface: Schema
        Compute the serialized size of the message.
        Specified by:
        getSerializedSize in interface Schema<T>
      • getUnknownFieldsSerializedSize

        private <UT,​UB> int getUnknownFieldsSerializedSize​(UnknownFieldSchema<UT,​UB> schema,
                                                                 T message)