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)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
value
protected volatile MessageLite value
LazyFieldLite
public LazyFieldLite(ExtensionRegistryLite extensionRegistry,
ByteString bytes)
LazyFieldLite
public LazyFieldLite()
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)