Class GeneratedMessage.ExtendableMessage<MessageT extends GeneratedMessage.ExtendableMessage<MessageT>>

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessage
com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT>
All Implemented Interfaces:
GeneratedMessage.ExtendableMessageOrBuilder<MessageT>, Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, MessageOrBuilder, Serializable
Direct Known Subclasses:
DescriptorProtos.EnumOptions, DescriptorProtos.EnumValueOptions, DescriptorProtos.ExtensionRangeOptions, DescriptorProtos.FeatureSet, DescriptorProtos.FieldOptions, DescriptorProtos.FileDescriptorSet, DescriptorProtos.FileOptions, DescriptorProtos.MessageOptions, DescriptorProtos.MethodOptions, DescriptorProtos.OneofOptions, DescriptorProtos.ServiceOptions, DescriptorProtos.SourceCodeInfo, GeneratedMessageV3
Enclosing class:
GeneratedMessage

public abstract static class GeneratedMessage.ExtendableMessage<MessageT extends GeneratedMessage.ExtendableMessage<MessageT>> extends GeneratedMessage implements GeneratedMessage.ExtendableMessageOrBuilder<MessageT>
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.

See Also: