|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.protobuf.AbstractMessageLite com.google.protobuf.AbstractMessage com.google.protobuf.GeneratedMessage com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageType>
public abstract static class GeneratedMessage.ExtendableMessage<MessageType extends GeneratedMessage.ExtendableMessage>
Generated message classes for message types that contain extension ranges subclass this.
This class implements type-safe accessors for extensions. They
implement all the same operations that you can do with normal fields --
e.g. "has", "get", and "getCount" -- but for extensions. The extensions
are identified using instances of the class GeneratedMessage.GeneratedExtension
;
the protocol compiler generates a static instance of this class for every
extension in its input. Through the magic of generics, all is made
type-safe.
For example, imagine you have the .proto
file:
option java_class = "MyProto"; message Foo { extensions 1000 to max; } extend Foo { optional int32 bar; }
Then you might write code like:
MyProto.Foo foo = getFoo(); int i = foo.getExtension(MyProto.bar);
See also GeneratedMessage.ExtendableBuilder
.
Nested Class Summary | |
---|---|
protected class |
GeneratedMessage.ExtendableMessage.ExtensionWriter
Used by subclasses to serialize extensions. |
Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessage |
---|
GeneratedMessage.Builder<BuilderType extends GeneratedMessage.Builder>, GeneratedMessage.BuilderParent, GeneratedMessage.ExtendableBuilder<MessageType extends GeneratedMessage.ExtendableMessage,BuilderType extends GeneratedMessage.ExtendableBuilder>, GeneratedMessage.ExtendableMessage<MessageType extends GeneratedMessage.ExtendableMessage>, GeneratedMessage.ExtendableMessageOrBuilder<MessageType extends GeneratedMessage.ExtendableMessage>, GeneratedMessage.FieldAccessorTable, GeneratedMessage.GeneratedExtension<ContainingType extends Message,Type> |
Field Summary |
---|
Fields inherited from class com.google.protobuf.GeneratedMessage |
---|
alwaysUseFieldBuilders |
Constructor Summary | |
---|---|
protected |
GeneratedMessage.ExtendableMessage()
|
protected |
GeneratedMessage.ExtendableMessage(GeneratedMessage.ExtendableBuilder<MessageType,?> builder)
|
Method Summary | ||
---|---|---|
protected boolean |
extensionsAreInitialized()
Called by subclasses to check if all extensions are initialized. |
|
protected int |
extensionsSerializedSize()
Called by subclasses to compute the size of extensions. |
|
protected int |
extensionsSerializedSizeAsMessageSet()
|
|
java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> |
getAllFields()
Returns a collection of all the fields in this message which are set and their corresponding values. |
|
|
getExtension(GeneratedMessage.GeneratedExtension<MessageType,java.util.List<Type>> extension,
int index)
Get one element of a repeated extension. |
|
|
getExtension(GeneratedMessage.GeneratedExtension<MessageType,Type> extension)
Get the value of an extension. |
|
|
getExtensionCount(GeneratedMessage.GeneratedExtension<MessageType,java.util.List<Type>> extension)
Get the number of elements in a repeated extension. |
|
protected java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> |
getExtensionFields()
|
|
java.lang.Object |
getField(Descriptors.FieldDescriptor field)
Obtains the value of the given field, or the default value if it is not set. |
|
java.lang.Object |
getRepeatedField(Descriptors.FieldDescriptor field,
int index)
Gets an element of a repeated field. |
|
int |
getRepeatedFieldCount(Descriptors.FieldDescriptor field)
Gets the number of elements of a repeated field. |
|
|
hasExtension(GeneratedMessage.GeneratedExtension<MessageType,Type> extension)
Check if a singular extension is present. |
|
boolean |
hasField(Descriptors.FieldDescriptor field)
Returns true if the given field is set. |
|
boolean |
isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false otherwise. |
|
protected GeneratedMessage.ExtendableMessage.ExtensionWriter |
newExtensionWriter()
|
|
protected GeneratedMessage.ExtendableMessage.ExtensionWriter |
newMessageSetExtensionWriter()
|
Methods inherited from class com.google.protobuf.GeneratedMessage |
---|
getDescriptorForType, getUnknownFields, internalGetFieldAccessorTable, newBuilderForType, newFileScopedGeneratedExtension, newMessageScopedGeneratedExtension, writeReplace |
Methods inherited from class com.google.protobuf.AbstractMessage |
---|
equals, getSerializedSize, hashBoolean, hashCode, hashEnum, hashEnumList, hashFields, hashLong, toString, writeTo |
Methods inherited from class com.google.protobuf.AbstractMessageLite |
---|
toByteArray, toByteString, writeDelimitedTo, writeTo |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.protobuf.MessageOrBuilder |
---|
getDefaultInstanceForType, getDescriptorForType, getUnknownFields |
Methods inherited from interface com.google.protobuf.Message |
---|
newBuilderForType, toBuilder |
Methods inherited from interface com.google.protobuf.MessageLite |
---|
toByteArray, toByteString, writeDelimitedTo, writeTo |
Constructor Detail |
---|
protected GeneratedMessage.ExtendableMessage()
protected GeneratedMessage.ExtendableMessage(GeneratedMessage.ExtendableBuilder<MessageType,?> builder)
Method Detail |
---|
public final <Type> boolean hasExtension(GeneratedMessage.GeneratedExtension<MessageType,Type> extension)
hasExtension
in interface GeneratedMessage.ExtendableMessageOrBuilder<MessageType extends GeneratedMessage.ExtendableMessage>
public final <Type> int getExtensionCount(GeneratedMessage.GeneratedExtension<MessageType,java.util.List<Type>> extension)
getExtensionCount
in interface GeneratedMessage.ExtendableMessageOrBuilder<MessageType extends GeneratedMessage.ExtendableMessage>
public final <Type> Type getExtension(GeneratedMessage.GeneratedExtension<MessageType,Type> extension)
getExtension
in interface GeneratedMessage.ExtendableMessageOrBuilder<MessageType extends GeneratedMessage.ExtendableMessage>
public final <Type> Type getExtension(GeneratedMessage.GeneratedExtension<MessageType,java.util.List<Type>> extension, int index)
getExtension
in interface GeneratedMessage.ExtendableMessageOrBuilder<MessageType extends GeneratedMessage.ExtendableMessage>
protected boolean extensionsAreInitialized()
public boolean isInitialized()
MessageLiteOrBuilder
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class GeneratedMessage
protected GeneratedMessage.ExtendableMessage.ExtensionWriter newExtensionWriter()
protected GeneratedMessage.ExtendableMessage.ExtensionWriter newMessageSetExtensionWriter()
protected int extensionsSerializedSize()
protected int extensionsSerializedSizeAsMessageSet()
protected java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> getExtensionFields()
public java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> getAllFields()
MessageOrBuilder
MessageOrBuilder.getField(Descriptors.FieldDescriptor)
for each field. The map
is guaranteed to be a sorted map, so iterating over it will return fields
in order by field number.
getAllFields
in interface MessageOrBuilder
getAllFields
in class GeneratedMessage
public boolean hasField(Descriptors.FieldDescriptor field)
MessageOrBuilder
hasField
in interface MessageOrBuilder
hasField
in class GeneratedMessage
public java.lang.Object getField(Descriptors.FieldDescriptor field)
MessageOrBuilder
getField
in interface MessageOrBuilder
getField
in class GeneratedMessage
public int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
MessageOrBuilder
getRepeatedFieldCount
in interface MessageOrBuilder
getRepeatedFieldCount
in class GeneratedMessage
public java.lang.Object getRepeatedField(Descriptors.FieldDescriptor field, int index)
MessageOrBuilder
getRepeatedField
in interface MessageOrBuilder
getRepeatedField
in class GeneratedMessage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |