webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
Public Member Functions | |
RepeatedFieldBuilder (List< MType > messages, boolean isMessagesListMutable, GeneratedMessage.BuilderParent parent, boolean isClean) | |
void | dispose () |
int | getCount () |
boolean | isEmpty () |
MType | getMessage (int index) |
BType | getBuilder (int index) |
IType | getMessageOrBuilder (int index) |
RepeatedFieldBuilder< MType, BType, IType > | setMessage (int index, MType message) |
RepeatedFieldBuilder< MType, BType, IType > | addMessage (MType message) |
RepeatedFieldBuilder< MType, BType, IType > | addMessage (int index, MType message) |
RepeatedFieldBuilder< MType, BType, IType > | addAllMessages (Iterable<? extends MType > values) |
BType | addBuilder (MType message) |
BType | addBuilder (int index, MType message) |
void | remove (int index) |
void | clear () |
List< MType > | build () |
List< MType > | getMessageList () |
List< BType > | getBuilderList () |
List< IType > | getMessageOrBuilderList () |
void | markDirty () |
implements a structure that a protocol message uses to hold a repeated field of other protocol messages. It supports the classical use case of adding immutable Message's to the repeated field and is highly optimized around this (no extra memory allocations and sharing of immutable arrays).
It also supports the additional use case of adding a Message.Builder to the repeated field and deferring conversion of that
to an immutable
. In this way, it's possible to maintain a tree of
's that acts as a fully read/write data structure.
Logically, one can think of a tree of builders as converting the entire tree to messages when build is called on the root or when any method is called that desires a Message instead of a Builder. In terms of the implementation, the
and
classes cache messages that were created so that messages only need to be created when some change occurred in its builder or a builder for one of its descendants.
<MType> | the type of message for the field |
<BType> | the type of builder for the field |
<IType> | the common interface for the message and the builder |
|
inline |
Constructs a new builder with an empty list of messages.
messages | the current list of messages |
isMessagesListMutable | Whether the messages list is mutable |
parent | a listener to notify of changes |
isClean | whether the builder is initially marked clean |
|
inline |
Appends all of the messages in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator.
values | the messages to add |
|
inline |
Appends a new builder to the end of this list and returns the builder.
message | the message to add which is the basis of the builder |
|
inline |
Inserts a new builder at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
index | the index at which to insert the builder |
message | the message to add which is the basis of the builder |
|
inline |
Appends the specified element to the end of this list.
message | the message to add |
|
inline |
Inserts the specified message at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
index | the index at which to insert the message |
message | the message to add |
|
inline |
Builds the list of messages from the builder and returns them.
|
inline |
Removes all of the elements from this list. The list will be empty after this call returns.
|
inline |
|
inline |
Gets a builder for the specified index. If no builder has been created for that index, a builder is created on demand by calling Message#toBuilder.
index | the index of the message to get |
|
inline |
Gets a view of the builder as a list of builders. This returned list is live and will reflect any changes to the underlying builder.
|
inline |
Gets the count of items in the list.
|
inline |
Get the message at the specified index. If the message is currently stored as a
, it is converted to a
by calling Message.Builder#buildPartial on it.
index | the index of the message to get |
|
inline |
Gets a view of the builder as a list of messages. The returned list is live and will reflect any changes to the underlying builder.
|
inline |
Gets the base class interface for the specified index. This may either be a builder or a message. It will return whatever is more efficient.
index | the index of the message to get |
|
inline |
Gets a view of the builder as a list of MessageOrBuilders. This returned list is live and will reflect any changes to the underlying builder.
|
inline |
Gets whether the list is empty.
|
inline |
A builder becomes dirty whenever a field is modified – including fields in nested builders – and becomes clean when build() is called. Thus, when a builder becomes dirty, all its parents become dirty as well, and when it becomes clean, all its children become clean. The dirtiness state is used to invalidate certain cached values.
To this end, a builder calls markAsDirty() on its parent whenever it transitions from clean to dirty. The parent must propagate this call to its own parent, unless it was already dirty, in which case the grandparent must necessarily already be dirty as well. The parent can only transition back to "clean" after calling build() on all children.
Implements com.google.protobuf.GeneratedMessage.BuilderParent.
|
inline |
Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
index | the index at which to remove the message |
|
inline |
Sets a message at the specified index replacing the existing item at that index.
index | the index to set. |
message | the message to set |