Package com.google.protobuf

## Class LazyFieldLite

- java.lang.Object
- - com.google.protobuf.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)

### Field Summary

Fields
`protected MessageLite` `value`

### Constructor Summary

Constructors
`LazyFieldLite()`
`LazyFieldLite​(ExtensionRegistryLite extensionRegistry, ByteString bytes)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `clear()`
`boolean` `containsDefaultInstance()`
`protected void` `ensureInitialized​(MessageLite defaultInstance)`
`static LazyFieldLite` `fromValue​(MessageLite value)`
`ExtensionRegistryLite` `getExtensionRegistry()`
`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.
`MessageLite` `getValue​(MessageLite defaultInstance)` Returns message instance.
`void` `merge​(LazyFieldLite value)`
`void` `setByteString​(ByteString bytes, ExtensionRegistryLite extensionRegistry)`
`MessageLite` `setValue​(MessageLite value)` LazyField is not thread-safe for write access.
`ByteString` `toByteString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### value

    protected volatile MessageLite value

### Constructor Detail

#### LazyFieldLite

    public LazyFieldLite​(ExtensionRegistryLite extensionRegistry,
                         ByteString bytes)

#### LazyFieldLite

    public LazyFieldLite()

### Method Detail

#### fromValue

    public static LazyFieldLite fromValue​(MessageLite value)

#### 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.

#### merge

    public void merge​(LazyFieldLite value)

#### setByteString

    public void setByteString​(ByteString bytes,
                              ExtensionRegistryLite extensionRegistry)

#### getExtensionRegistry

    public ExtensionRegistryLite getExtensionRegistry()

#### 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.

#### toByteString

    public ByteString toByteString()

#### ensureInitialized

    protected void ensureInitialized​(MessageLite defaultInstance)