Class MicroEJMessageLite


  • public abstract class MicroEJMessageLite
    extends 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

      • 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.
      • toByteString

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

        protected final boolean parseUnknownField​(int tag,
                                                  CodedInputStream input)
                                           throws 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:
        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: a repeated extension appends, a message-typed extension merges, any other singular extension is replaced. For use by generated builder code.
      • parseExtensionOrUnknownField

        protected boolean parseExtensionOrUnknownField​(MicroEJMessageLite defaultInstance,
                                                       CodedInputStream input,
                                                       ExtensionRegistryLite extensionRegistry,
                                                       int tag)
                                                throws IOException
        Parse an extension, or an unknown field when the registry knows no extension for the tag. 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:
        IOException
      • setExtension

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

        protected final <T> void addRepeatedExtension​(GeneratedMessageLite.GeneratedExtension<?,​List<T>> extension,
                                                      T value)
        Add a repeated extension value. 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 and unknown fields immutable. For use by generated makeImmutable().
      • unknownFieldsMakeImmutable

        protected void unknownFieldsMakeImmutable()
        Make the unknown fields immutable. For use by generated makeImmutable().
      • extensionsAreInitialized

        protected boolean extensionsAreInitialized()
        Check that every message-typed extension is initialized. For use by generated isInitialized().
      • extensionsSerializedSize

        protected int extensionsSerializedSize()
        Returns the serialized size of all extension fields.
      • 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.