Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.google.protobuf.LazyFieldLite Class Reference
Inheritance diagram for com.google.protobuf.LazyFieldLite:
Inheritance graph
[legend]

Public Member Functions

void clear ()
 
void clear ()
 
boolean containsDefaultInstance ()
 
boolean containsDefaultInstance ()
 
boolean equals (Object o)
 
boolean equals (Object o)
 
int getSerializedSize ()
 
int getSerializedSize ()
 
MessageLite getValue (MessageLite defaultInstance)
 
MessageLite getValue (MessageLite defaultInstance)
 
int hashCode ()
 
int hashCode ()
 
 LazyFieldLite ()
 
 LazyFieldLite ()
 
 LazyFieldLite (ExtensionRegistryLite extensionRegistry, ByteString bytes)
 
 LazyFieldLite (ExtensionRegistryLite extensionRegistry, ByteString bytes)
 
void merge (LazyFieldLite other)
 
void merge (LazyFieldLite other)
 
void mergeFrom (CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
 
void mergeFrom (CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
 
void set (LazyFieldLite other)
 
void set (LazyFieldLite other)
 
void setByteString (ByteString bytes, ExtensionRegistryLite extensionRegistry)
 
void setByteString (ByteString bytes, ExtensionRegistryLite extensionRegistry)
 
MessageLite setValue (MessageLite value)
 
MessageLite setValue (MessageLite value)
 
ByteString toByteString ()
 
ByteString toByteString ()
 

Static Public Member Functions

static LazyFieldLite fromValue (MessageLite value)
 
static LazyFieldLite fromValue (MessageLite value)
 

Protected Member Functions

void ensureInitialized (MessageLite defaultInstance)
 
void ensureInitialized (MessageLite defaultInstance)
 

Protected Attributes

volatile MessageLite value
 

Static Private Member Functions

static void checkArguments (ExtensionRegistryLite extensionRegistry, ByteString bytes)
 
static void checkArguments (ExtensionRegistryLite extensionRegistry, ByteString bytes)
 
static MessageLite mergeValueAndBytes (MessageLite value, ByteString otherBytes, ExtensionRegistryLite extensionRegistry)
 
static MessageLite mergeValueAndBytes (MessageLite value, ByteString otherBytes, ExtensionRegistryLite extensionRegistry)
 

Private Attributes

ByteString delayedBytes
 
ExtensionRegistryLite extensionRegistry
 
volatile ByteString memoizedBytes
 

Static Private Attributes

static final ExtensionRegistryLite EMPTY_REGISTRY
 

Detailed Description

LazyFieldLite encapsulates the logic of lazily parsing message fields. It stores the message in a ByteString initially and then parses it on-demand.

LazyFieldLite is thread-compatible: concurrent reads are safe once the proto that this LazyFieldLite is a part of is no longer being mutated by its Builder. However, explicit synchronization is needed under read/write situations.

When a LazyFieldLite is used in the context of a MessageLite object, its behavior is considered to be immutable and none of the setter methods in its API are expected to be invoked. All of the getters are expected to be thread-safe. When used in the context of a MessageLite.Builder, setters can be invoked, but there is no guarantee of thread safety.

TODO(yatin,dweis): Consider splitting this class's functionality and put the mutable methods into a separate builder class to allow us to give stronger compile-time guarantees.

This class is internal implementation detail of the protobuf library, so you don't need to use it directly.

Author
xiang.nosp@m.l@go.nosp@m.ogle..nosp@m.com (Xiang Li)

Definition at line 56 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

Constructor & Destructor Documentation

◆ LazyFieldLite() [1/4]

com.google.protobuf.LazyFieldLite.LazyFieldLite ( ExtensionRegistryLite  extensionRegistry,
ByteString  bytes 
)
inline

Constructs a LazyFieldLite with bytes that will be parsed lazily.

Definition at line 118 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ LazyFieldLite() [2/4]

com.google.protobuf.LazyFieldLite.LazyFieldLite ( )
inline

Constructs a LazyFieldLite with no contents, and no ability to parse extensions.

Definition at line 125 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ LazyFieldLite() [3/4]

com.google.protobuf.LazyFieldLite.LazyFieldLite ( ExtensionRegistryLite  extensionRegistry,
ByteString  bytes 
)
inline

Constructs a LazyFieldLite with bytes that will be parsed lazily.

Definition at line 118 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ LazyFieldLite() [4/4]

com.google.protobuf.LazyFieldLite.LazyFieldLite ( )
inline

Constructs a LazyFieldLite with no contents, and no ability to parse extensions.

Definition at line 125 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

Member Function Documentation

◆ checkArguments() [1/2]

static void com.google.protobuf.LazyFieldLite.checkArguments ( ExtensionRegistryLite  extensionRegistry,
ByteString  bytes 
)
inlinestaticprivate

◆ checkArguments() [2/2]

static void com.google.protobuf.LazyFieldLite.checkArguments ( ExtensionRegistryLite  extensionRegistry,
ByteString  bytes 
)
inlinestaticprivate

◆ clear() [1/2]

void com.google.protobuf.LazyFieldLite.clear ( )
inline

Clears the value state of this instance.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 188 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ clear() [2/2]

void com.google.protobuf.LazyFieldLite.clear ( )
inline

Clears the value state of this instance.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 188 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ containsDefaultInstance() [1/2]

boolean com.google.protobuf.LazyFieldLite.containsDefaultInstance ( )
inline

Determines whether this LazyFieldLite instance represents the default instance of this type.

Reimplemented in com.google.protobuf.LazyField, and com.google.protobuf.LazyField.

Definition at line 177 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ containsDefaultInstance() [2/2]

boolean com.google.protobuf.LazyFieldLite.containsDefaultInstance ( )
inline

Determines whether this LazyFieldLite instance represents the default instance of this type.

Reimplemented in com.google.protobuf.LazyField, and com.google.protobuf.LazyField.

Definition at line 177 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ ensureInitialized() [1/2]

void com.google.protobuf.LazyFieldLite.ensureInitialized ( MessageLite  defaultInstance)
inlineprotected

Might lazily parse the bytes that were previously passed in. Is thread-safe.

Definition at line 405 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ ensureInitialized() [2/2]

void com.google.protobuf.LazyFieldLite.ensureInitialized ( MessageLite  defaultInstance)
inlineprotected

Might lazily parse the bytes that were previously passed in. Is thread-safe.

Definition at line 405 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ equals() [1/2]

boolean com.google.protobuf.LazyFieldLite.equals ( Object  o)
inline

◆ equals() [2/2]

boolean com.google.protobuf.LazyFieldLite.equals ( Object  o)
inline

◆ fromValue() [1/2]

static LazyFieldLite com.google.protobuf.LazyFieldLite.fromValue ( MessageLite  value)
inlinestatic

Constructs a LazyFieldLite instance with a value. The LazyFieldLite may not be able to parse the extensions in the value as it has no ExtensionRegistry.

Definition at line 131 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ fromValue() [2/2]

static LazyFieldLite com.google.protobuf.LazyFieldLite.fromValue ( MessageLite  value)
inlinestatic

Constructs a LazyFieldLite instance with a value. The LazyFieldLite may not be able to parse the extensions in the value as it has no ExtensionRegistry.

Definition at line 131 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ getSerializedSize() [1/2]

int com.google.protobuf.LazyFieldLite.getSerializedSize ( )
inline

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.

Definition at line 354 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ getSerializedSize() [2/2]

int com.google.protobuf.LazyFieldLite.getSerializedSize ( )
inline

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.

Definition at line 354 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ getValue() [1/2]

MessageLite com.google.protobuf.LazyFieldLite.getValue ( MessageLite  defaultInstance)
inline

Returns message instance. It may do some thread-safe delayed parsing of bytes.

Parameters
defaultInstanceits message's default instance. It's also used to get parser for the message type.

Definition at line 222 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ getValue() [2/2]

MessageLite com.google.protobuf.LazyFieldLite.getValue ( MessageLite  defaultInstance)
inline

Returns message instance. It may do some thread-safe delayed parsing of bytes.

Parameters
defaultInstanceits message's default instance. It's also used to get parser for the message type.

Definition at line 222 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ hashCode() [1/2]

int com.google.protobuf.LazyFieldLite.hashCode ( )
inline

◆ hashCode() [2/2]

int com.google.protobuf.LazyFieldLite.hashCode ( )
inline

◆ merge() [1/2]

void com.google.protobuf.LazyFieldLite.merge ( LazyFieldLite  other)
inline

Merges another instance's contents. In some cases may drop some extensions if both fields contain data. If the other field has an

ExtensionRegistry

but this does not, then this field will copy over that

ExtensionRegistry

.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 249 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ merge() [2/2]

void com.google.protobuf.LazyFieldLite.merge ( LazyFieldLite  other)
inline

Merges another instance's contents. In some cases may drop some extensions if both fields contain data. If the other field has an

ExtensionRegistry

but this does not, then this field will copy over that

ExtensionRegistry

.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 249 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ mergeFrom() [1/2]

void com.google.protobuf.LazyFieldLite.mergeFrom ( CodedInputStream  input,
ExtensionRegistryLite  extensionRegistry 
) throws IOException
inline

Merges another instance's contents from a stream.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 296 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ mergeFrom() [2/2]

void com.google.protobuf.LazyFieldLite.mergeFrom ( CodedInputStream  input,
ExtensionRegistryLite  extensionRegistry 
) throws IOException
inline

Merges another instance's contents from a stream.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 296 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ mergeValueAndBytes() [1/2]

static MessageLite com.google.protobuf.LazyFieldLite.mergeValueAndBytes ( MessageLite  value,
ByteString  otherBytes,
ExtensionRegistryLite  extensionRegistry 
)
inlinestaticprivate

◆ mergeValueAndBytes() [2/2]

static MessageLite com.google.protobuf.LazyFieldLite.mergeValueAndBytes ( MessageLite  value,
ByteString  otherBytes,
ExtensionRegistryLite  extensionRegistry 
)
inlinestaticprivate

◆ set() [1/2]

void com.google.protobuf.LazyFieldLite.set ( LazyFieldLite  other)
inline

Overrides the contents of this LazyField.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 203 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ set() [2/2]

void com.google.protobuf.LazyFieldLite.set ( LazyFieldLite  other)
inline

Overrides the contents of this LazyField.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 203 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ setByteString() [1/2]

void com.google.protobuf.LazyFieldLite.setByteString ( ByteString  bytes,
ExtensionRegistryLite  extensionRegistry 
)
inline

Sets this field with bytes to delay-parse.

Definition at line 342 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ setByteString() [2/2]

void com.google.protobuf.LazyFieldLite.setByteString ( ByteString  bytes,
ExtensionRegistryLite  extensionRegistry 
)
inline

Sets this field with bytes to delay-parse.

Definition at line 342 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ setValue() [1/2]

MessageLite com.google.protobuf.LazyFieldLite.setValue ( MessageLite  value)
inline

Sets the value of the instance and returns the old value without delay parsing anything.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 233 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ setValue() [2/2]

MessageLite com.google.protobuf.LazyFieldLite.setValue ( MessageLite  value)
inline

Sets the value of the instance and returns the old value without delay parsing anything.

LazyField is not thread-safe for write access. Synchronizations are needed under read/write situations.

Definition at line 233 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ toByteString() [1/2]

ByteString com.google.protobuf.LazyFieldLite.toByteString ( )
inline

Returns a BytesString for this field in a thread-safe way.

Definition at line 369 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ toByteString() [2/2]

ByteString com.google.protobuf.LazyFieldLite.toByteString ( )
inline

Returns a BytesString for this field in a thread-safe way.

Definition at line 369 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

Member Data Documentation

◆ delayedBytes

ByteString com.google.protobuf.LazyFieldLite.delayedBytes
private

A delayed-parsed version of the contents of this field. When this field is non-null, then the "value" field is allowed to be null until the time that the value needs to be read.

When delayedBytes is non-null then

is required to also be non-null.

and

will be initialized lazily.

Definition at line 94 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ EMPTY_REGISTRY

static final ExtensionRegistryLite com.google.protobuf.LazyFieldLite.EMPTY_REGISTRY
staticprivate
Initial value:
=
ExtensionRegistryLite.getEmptyRegistry()

Definition at line 57 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ extensionRegistry

ExtensionRegistryLite com.google.protobuf.LazyFieldLite.extensionRegistry
private

An

ExtensionRegistryLite

for parsing bytes. It is non-null on a best-effort basis. It is only guaranteed to be non-null if this message was initialized using bytes and an

ExtensionRegistry

. If it directly had a value set then it will be null, unless it has been merged with another

that had an

ExtensionRegistry

.

Definition at line 102 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ memoizedBytes

volatile ByteString com.google.protobuf.LazyFieldLite.memoizedBytes
private

The memoized bytes for

. This is an optimization for the toByteString() method to not have to recompute its return-value on each invocation. TODO(yatin): Figure out whether this optimization is actually necessary.

Definition at line 115 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.

◆ value

volatile MessageLite com.google.protobuf.LazyFieldLite.value
protected

The parsed value. When this is null and a caller needs access to the MessageLite value, then

will be parsed lazily at that time.

Definition at line 108 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java.


The documentation for this class was generated from the following file:
com.google.protobuf.LazyFieldLite.LazyFieldLite
LazyFieldLite()
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java:125
com.google.protobuf.LazyFieldLite.value
volatile MessageLite value
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java:108
com.google.protobuf.LazyFieldLite.delayedBytes
ByteString delayedBytes
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java:94
com.google.protobuf.LazyFieldLite.memoizedBytes
volatile ByteString memoizedBytes
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java:115
com.google.protobuf.LazyFieldLite.extensionRegistry
ExtensionRegistryLite extensionRegistry
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java:102


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:06