public abstract static class GeneratedMessageLite.ExtendableMessage<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>> extends GeneratedMessageLite<MessageType,BuilderType> implements GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType,BuilderType>
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 GeneratedMessageLite.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);
Modifier and Type | Class and Description |
---|---|
protected class |
GeneratedMessageLite.ExtendableMessage.ExtensionWriter
Used by subclasses to serialize extensions.
|
GeneratedMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>, GeneratedMessageLite.DefaultInstanceBasedParser<T extends GeneratedMessageLite<T,?>>, GeneratedMessageLite.ExtendableBuilder<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageLite.ExtendableMessage<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageLite.GeneratedExtension<ContainingType extends MessageLite,Type>, GeneratedMessageLite.MergeFromVisitor, GeneratedMessageLite.MethodToInvoke, GeneratedMessageLite.SerializedForm, GeneratedMessageLite.Visitor
Modifier and Type | Field and Description |
---|---|
protected com.google.protobuf.FieldSet<com.google.protobuf.GeneratedMessageLite.ExtensionDescriptor> |
extensions
Represents the set of extensions on this message.
|
memoizedSerializedSize, unknownFields
memoizedHashCode
Constructor and Description |
---|
ExtendableMessage() |
Modifier and Type | Method and Description |
---|---|
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() |
<Type> Type |
getExtension(ExtensionLite<MessageType,List<Type>> extension,
int index)
Get one element of a repeated extension.
|
<Type> Type |
getExtension(ExtensionLite<MessageType,Type> extension)
Get the value of an extension.
|
<Type> int |
getExtensionCount(ExtensionLite<MessageType,List<Type>> extension)
Get the number of elements in a repeated extension.
|
<Type> boolean |
hasExtension(ExtensionLite<MessageType,Type> extension)
Check if a singular extension is present.
|
protected void |
makeImmutable()
Called by subclasses to complete parsing.
|
protected void |
mergeExtensionFields(MessageType other) |
protected GeneratedMessageLite.ExtendableMessage.ExtensionWriter |
newExtensionWriter() |
protected GeneratedMessageLite.ExtendableMessage.ExtensionWriter |
newMessageSetExtensionWriter() |
protected <MessageType extends MessageLite> |
parseUnknownField(MessageType defaultInstance,
CodedInputStream input,
ExtensionRegistryLite extensionRegistry,
int tag)
Parse an unknown field or an extension.
|
dynamicMethod, dynamicMethod, dynamicMethod, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, emptyProtobufList, equals, getDefaultInstanceForType, getParserForType, hashCode, isInitialized, isInitialized, makeImmutable, mergeLengthDelimitedField, mergeUnknownFields, mergeVarintField, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBuilderForType, newRepeatedGeneratedExtension, newSingularGeneratedExtension, parseDelimitedFrom, parseDelimitedFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parsePartialFrom, parseUnknownField, toBuilder
addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
clone, getClass, notify, notifyAll, toString, wait, wait, wait
getDefaultInstanceForType, isInitialized
getSerializedSize, writeTo
protected com.google.protobuf.FieldSet<com.google.protobuf.GeneratedMessageLite.ExtensionDescriptor> extensions
protected boolean extensionsAreInitialized()
protected int extensionsSerializedSize()
protected int extensionsSerializedSizeAsMessageSet()
public final <Type> Type getExtension(ExtensionLite<MessageType,List<Type>> extension, int index)
getExtension
in interface GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>
public final <Type> Type getExtension(ExtensionLite<MessageType,Type> extension)
getExtension
in interface GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>
public final <Type> int getExtensionCount(ExtensionLite<MessageType,List<Type>> extension)
getExtensionCount
in interface GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>
public final <Type> boolean hasExtension(ExtensionLite<MessageType,Type> extension)
hasExtension
in interface GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>
protected final void makeImmutable()
GeneratedMessageLite
makeImmutable
in class GeneratedMessageLite<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>
protected final void mergeExtensionFields(MessageType other)
protected GeneratedMessageLite.ExtendableMessage.ExtensionWriter newExtensionWriter()
protected GeneratedMessageLite.ExtendableMessage.ExtensionWriter newMessageSetExtensionWriter()
protected <MessageType extends MessageLite> boolean parseUnknownField(MessageType defaultInstance, CodedInputStream input, ExtensionRegistryLite extensionRegistry, int tag) throws IOException
For use by generated code only.
true
unless the tag is an end-group tag.IOException