Top Description Inners Fields Constructors Methods
com.google.protobuf

public Class LazyField

extends LazyFieldLite
Class Inheritance
Imports
java.util.Iterator, .Map.Entry

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

Most of key methods are implemented in LazyFieldLite but this class can contain default instance of the message to provide hashCode(), euqals() and toString().

Author
[email protected] (Xiang Li)

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
LazyField.LazyEntry<K>

LazyEntry and LazyIterator are used to encapsulate the LazyField, when users iterate all fields from FieldSet.

pack-priv static class

Field Summary

Modifier and TypeField and Description
private final MessageLite
defaultInstance

Carry a message's default instance which is used by hashCode(), euqals() and toString().

Inherited from com.google.protobuf.LazyFieldLite:
value

Constructor Summary

AccessConstructor and Description
public
LazyField(MessageLite defaultInstance, ExtensionRegistryLite extensionRegistry, ByteString bytes)

Method Summary

Modifier and TypeMethod and Description
public boolean
containsDefaultInstance()

Overrides com.google.protobuf.LazyFieldLite.containsDefaultInstance.

Determines whether this LazyFieldLite instance represents the default instance of this type.
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides com.google.protobuf.LazyFieldLite.equals.

Indicates whether some other object is "equal to" this one.
public MessageLite
public int
hashCode()

Overrides com.google.protobuf.LazyFieldLite.hashCode.

Returns a hash code value for the object.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from com.google.protobuf.LazyFieldLite:
clearensureInitializedfromValuegetSerializedSizegetValuemergemergeFromsetsetByteStringsetValuetoByteString

Field Detail

defaultInstanceback to summary
private final MessageLite defaultInstance

Carry a message's default instance which is used by hashCode(), euqals() and toString().

Constructor Detail

LazyFieldback to summary
public LazyField(MessageLite defaultInstance, ExtensionRegistryLite extensionRegistry, ByteString bytes)

Method Detail

containsDefaultInstanceback to summary
public boolean containsDefaultInstance()

Overrides com.google.protobuf.LazyFieldLite.containsDefaultInstance.

Doc from com.google.protobuf.LazyFieldLite.containsDefaultInstance.

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

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides com.google.protobuf.LazyFieldLite.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getValueback to summary
public MessageLite getValue()
hashCodeback to summary
public int hashCode()

Overrides com.google.protobuf.LazyFieldLite.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
com.google.protobuf back to summary

pack-priv Class LazyField.LazyEntry<K>

extends Object
implements Map.Entry<K, Object>
Class Inheritance
All Implemented Interfaces
java.util.Map.Entry

LazyEntry and LazyIterator are used to encapsulate the LazyField, when users iterate all fields from FieldSet.

Field Summary

Modifier and TypeField and Description
private Map.Entry<K, LazyField>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public LazyField
public K
getKey()

Implements java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.
public Object
getValue()

Implements java.util.Map.Entry.getValue.

Returns the value corresponding to this entry.
public Object
setValue(Object
new value to be stored in this entry
value
)

Implements java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entryback to summary
private Map.Entry<K, LazyField> entry

Constructor Detail

LazyEntryback to summary
private LazyEntry(Map.Entry<K, LazyField> entry)

Method Detail

getFieldback to summary
public LazyField getField()
getKeyback to summary
public K getKey()

Implements java.util.Map.Entry.getKey.

Doc from java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

Returns:K

the key corresponding to this entry

Annotations
@Override
getValueback to summary
public Object getValue()

Implements java.util.Map.Entry.getValue.

Doc from java.util.Map.Entry.getValue.

Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.

Returns:Object

the value corresponding to this entry

Annotations
@Override
setValueback to summary
public Object setValue(Object value)

Implements java.util.Map.Entry.setValue.

Doc from java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator's remove operation).

Parameters
value:Object

new value to be stored in this entry

Returns:Object

old value corresponding to the entry

Annotations
@Override
com.google.protobuf back to summary

pack-priv Class LazyField.LazyIterator<K>

extends Object
implements Iterator<Map.Entry<K, Object>>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private Iterator<Map.Entry<K, Object>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public Map.Entry<K, Object>
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iteratorback to summary
private Iterator<Map.Entry<K, Object>> iterator

Constructor Detail

LazyIteratorback to summary
public LazyIterator(Iterator<Map.Entry<K, Object>> iterator)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public Map.Entry<K, Object> next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Map.Entry<K, Object>

the next element in the iteration

Annotations
@Override
@SuppressWarnings:unchecked
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override