Class MicroEJMessageLite


  • public abstract class MicroEJMessageLite
    extends java.lang.Object
    Base class for MicroEJ-generated protobuf messages.

    Replaces GeneratedMessageLite for environments without java.lang.reflect. Generated message classes extend this and provide inline writeTo, mergeFrom, and getSerializedSize implementations — no schema engine or reflection needed.

    Supports proto2 extensions via FieldSet and ExtensionRegistryLite.

    • Field Detail

      • memoizedSerializedSize

        protected int memoizedSerializedSize
      • extensions

        protected com.google.protobuf.FieldSet<com.google.protobuf.GeneratedMessageLite.ExtensionDescriptor> extensions
        Extension fields for extensible messages.
    • Constructor Detail

      • MicroEJMessageLite

        public MicroEJMessageLite()
    • Method Detail

      • writeTo

        public abstract void writeTo​(CodedOutputStream output)
                              throws java.io.IOException
        Serializes this message to a CodedOutputStream.
        Throws:
        java.io.IOException
      • getSerializedSize

        public abstract int getSerializedSize()
        Returns the number of bytes required to serialize this message.
      • getDefaultInstanceForType

        public abstract MicroEJMessageLite getDefaultInstanceForType()
        Returns a new default (empty) instance of this message type.
      • isInitialized

        public boolean isInitialized()
        Returns true if all required fields are set (always true for proto3).
      • toByteArray

        public final byte[] toByteArray()
        Serializes this message to a byte array.
      • writeTo

        public final void writeTo​(java.io.OutputStream output)
                           throws java.io.IOException
        Serializes this message to an OutputStream.
        Throws:
        java.io.IOException
      • writeDelimitedTo

        public final void writeDelimitedTo​(java.io.OutputStream output)
                                    throws java.io.IOException
        Serializes this message with a varint length prefix to an OutputStream.
        Throws:
        java.io.IOException
      • toByteString

        public final ByteString toByteString()
        Returns a ByteString containing the serialized message.
      • parseUnknownField

        protected final boolean parseUnknownField​(int tag,
                                                  CodedInputStream input)
                                           throws java.io.IOException
        Parses an unknown field during mergeFrom and stores it for round-trip preservation.
        Parameters:
        tag - the field tag that was not recognized
        input - the input stream positioned after the tag
        Returns:
        false if the tag is an end-group marker, true otherwise
        Throws:
        java.io.IOException
      • getUnknownFields

        public final UnknownFieldSetLite getUnknownFields()
        Returns the unknown fields stored during parsing.
      • ensureExtensionsAreMutable

        protected com.google.protobuf.FieldSet<com.google.protobuf.GeneratedMessageLite.ExtensionDescriptor> ensureExtensionsAreMutable()
        Ensure the extension FieldSet is mutable. For use by generated code.
      • mergeExtensionFields

        protected void mergeExtensionFields​(MicroEJMessageLite other)
        Merge extension fields from another message. Simple copy for singular fields, append for repeated fields. For use by generated builder code.
      • parseUnknownField

        protected boolean parseUnknownField​(MicroEJMessageLite defaultInstance,
                                            CodedInputStream input,
                                            ExtensionRegistryLite extensionRegistry,
                                            int tag)
                                     throws java.io.IOException
        Parse an extension or unknown field. For use by generated code only.
        Parameters:
        defaultInstance - the default instance of this message type (for registry lookup)
        input - the coded input stream
        extensionRegistry - the extension registry
        tag - the field tag already read
        Returns:
        true unless the tag is an end-group tag
        Throws:
        java.io.IOException
      • getExtensionCount

        public final <Type> int getExtensionCount​(GeneratedMessageLite.GeneratedExtension<?,​java.util.List<Type>> extension)
        Get the number of elements in a repeated extension.
      • setExtension

        public final <Type> void setExtension​(GeneratedMessageLite.GeneratedExtension<?,​Type> extension,
                                              Type value)
        Set a singular extension value. For use by generated Builder code.
      • addRepeatedExtension

        public final <Type> void addRepeatedExtension​(GeneratedMessageLite.GeneratedExtension<?,​java.util.List<Type>> extension,
                                                      Type value)
        Add a repeated extension value. For use by generated Builder code.
      • copyExtensionsFrom

        public void copyExtensionsFrom​(MicroEJMessageLite other)
        Copy all extensions from another message. For use by generated Builder code.
      • extensionsAreEmpty

        protected boolean extensionsAreEmpty()
        Check if extensions are empty. For use by generated code.
      • extensionsAreEqual

        protected boolean extensionsAreEqual​(MicroEJMessageLite other)
        Compare extensions with another message. For use by generated equals().
      • extensionsHashCode

        protected int extensionsHashCode()
        Hash code of extensions. For use by generated hashCode().
      • extensionsMakeImmutable

        protected void extensionsMakeImmutable()
        Make extensions immutable. For use by generated makeImmutable().
      • extensionsSerializedSize

        protected int extensionsSerializedSize()
        Returns the serialized size of all extension fields.
      • microejParseFrom

        protected MicroEJMessageLite microejParseFrom​(CodedInputStream input)
                                               throws java.io.IOException
        Parse a new instance of this message type from a stream. Generated code overrides this for message-type extension support.
        Throws:
        java.io.IOException
      • microejMerge

        protected MicroEJMessageLite microejMerge​(MicroEJMessageLite other)
        Create a new message by merging this message with another of the same type. Generated code overrides this for message-type extension support.