Class GeneratedMessage.ExtendableBuilder<MessageT extends GeneratedMessage.ExtendableMessage<MessageT>,BuilderT extends GeneratedMessage.ExtendableBuilder<MessageT,BuilderT>>

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

public abstract static class GeneratedMessage.ExtendableBuilder<MessageT extends GeneratedMessage.ExtendableMessage<MessageT>,BuilderT extends GeneratedMessage.ExtendableBuilder<MessageT,BuilderT>> extends GeneratedMessage.Builder<BuilderT> implements GeneratedMessage.ExtendableMessageOrBuilder<MessageT>
Generated message builders 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. "get", "set", and "add" -- 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 =
   MyProto.Foo.newBuilder()
     .setExtension(MyProto.bar, 123)
     .build();
 

See also GeneratedMessage.ExtendableMessage.