Package com.google.protobuf
Class LazyFieldLite
java.lang.Object
com.google.protobuf.LazyFieldLite
- Direct Known Subclasses:
LazyField
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
protected void
ensureInitialized
(MessageLite defaultInstance) static LazyFieldLite
fromValue
(MessageLite value) int
Due to the optional field can be duplicated at the end of serialized bytes, which will make the serialized size changed after LazyField parsed.getValue
(MessageLite defaultInstance) Returns message instance.void
merge
(LazyFieldLite value) void
setByteString
(ByteString bytes, ExtensionRegistryLite extensionRegistry) setValue
(MessageLite value) LazyField is not thread-safe for write access.
-
Field Details
-
value
-
-
Constructor Details
-
LazyFieldLite
-
LazyFieldLite
public LazyFieldLite()
-
-
Method Details
-
fromValue
-
containsDefaultInstance
public boolean containsDefaultInstance() -
clear
public void clear() -
getValue
Returns message instance. At first time, serialized data is parsed bydefaultInstance.getParserForType()
.- Parameters:
defaultInstance
- its message's default instance. It's also used to get parser for the message type.
-
setValue
LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations. -
merge
-
setByteString
-
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
-
ensureInitialized
-