Class GeneratedMessageV3.ExtendableMessage<MessageType extends GeneratedMessageV3.ExtendableMessage>

All Implemented Interfaces:
GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType>, Message, MessageLite, MessageLiteOrBuilder, MessageOrBuilder, Serializable
Direct Known Subclasses:
DescriptorProtos.EnumOptions, DescriptorProtos.EnumValueOptions, DescriptorProtos.ExtensionRangeOptions, DescriptorProtos.FieldOptions, DescriptorProtos.FileOptions, DescriptorProtos.MessageOptions, DescriptorProtos.MethodOptions, DescriptorProtos.OneofOptions, DescriptorProtos.ServiceOptions
Enclosing class:
GeneratedMessageV3

public abstract static class GeneratedMessageV3.ExtendableMessage<MessageType extends GeneratedMessageV3.ExtendableMessage> extends GeneratedMessageV3 implements GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType>
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 GeneratedMessageV3.ExtendableBuilder.

See Also: