Class LazyFieldLite

  • Direct Known Subclasses:
    LazyField

    public class LazyFieldLite
    extends java.lang.Object
    LazyFieldLite encapsulates the logic of lazily parsing message fields. It stores the message in a ByteString initially and then parse it on-demand. LazyField is thread-compatible e.g. concurrent read are safe, however, synchronizations are needed under read/write situations. This class is internal implementation detail, so you don't need to use it directly.
    Author:
    xiangl@google.com (Xiang Li)
    • Method Detail

      • containsDefaultInstance

        public boolean containsDefaultInstance()
      • clear

        public void clear()
      • getValue

        public MessageLite getValue​(MessageLite defaultInstance)
        Returns message instance. At first time, serialized data is parsed by defaultInstance.getParserForType().
        Parameters:
        defaultInstance - its message's default instance. It's also used to get parser for the message type.
      • setValue

        public MessageLite setValue​(MessageLite value)
        LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.
      • getSerializedSize

        public int getSerializedSize()
        Due to the optional field can be duplicated at the end of serialized bytes, which will make the serialized size changed after LazyField parsed. Be careful when using this method.
      • ensureInitialized

        protected void ensureInitialized​(MessageLite defaultInstance)