Package com.google.protobuf
Class GeneratedMessage.GeneratedExtension<ContainingT extends Message,T>
java.lang.Object
com.google.protobuf.ExtensionLite<ContainingT,T>
com.google.protobuf.Extension<ContainingT,T>
com.google.protobuf.GeneratedMessage.GeneratedExtension<ContainingT,T>
- Enclosing class:
GeneratedMessage
public static class GeneratedMessage.GeneratedExtension<ContainingT extends Message,T>
extends Extension<ContainingT,T>
Type used to represent generated extensions. The protocol compiler generates a static singleton
instance of this class for each extension.
For example, imagine you have the .proto
file:
option java_class = "MyProto"; message Foo { extensions 1000 to max; } extend Foo { optional int32 bar; }
Then, MyProto.Foo.bar
has type GeneratedExtension<MyProto.Foo, Integer>
.
In general, users should ignore the details of this type, and simply use these static
singletons as parameters to the extension accessors defined in GeneratedMessage.ExtendableMessage
and
GeneratedMessage.ExtendableBuilder
.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.protobuf.Extension
Extension.ExtensionType, Extension.MessageType
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
fromReflectionType
(Object value) Convert from the type used by the reflection accessors to the type used by native accessors.Returns the descriptor of the extension.protected Extension.ExtensionType
com.google.protobuf.WireFormat.FieldType
If the extension is an embedded message or group, returns the default instance of the message.int
void
internalInit
(Descriptors.FieldDescriptor descriptor) For use by generated code only.boolean
protected Object
singularFromReflectionType
(Object value) LikefromReflectionType(Object)
, but if the type is a repeated type, this converts a single element.protected Object
singularToReflectionType
(Object value) LiketoReflectionType(Object)
, but if the type is a repeated type, this converts a single element.protected Object
toReflectionType
(Object value) Convert from the type used by the native accessors to the type used by reflection accessors.Methods inherited from class com.google.protobuf.Extension
getMessageType
-
Method Details
-
internalInit
For use by generated code only. -
getDescriptor
Description copied from class:Extension
Returns the descriptor of the extension.- Specified by:
getDescriptor
in classExtension<ContainingT extends Message,
T>
-
getMessageDefaultInstance
If the extension is an embedded message or group, returns the default instance of the message.- Specified by:
getMessageDefaultInstance
in classExtension<ContainingT extends Message,
T>
-
getExtensionType
- Specified by:
getExtensionType
in classExtension<ContainingT extends Message,
T>
-
fromReflectionType
Convert from the type used by the reflection accessors to the type used by native accessors. E.g., for enums, the reflection accessors use EnumValueDescriptors but the native accessors use the generated enum type.- Specified by:
fromReflectionType
in classExtension<ContainingT extends Message,
T>
-
singularFromReflectionType
LikefromReflectionType(Object)
, but if the type is a repeated type, this converts a single element.- Specified by:
singularFromReflectionType
in classExtension<ContainingT extends Message,
T>
-
toReflectionType
Convert from the type used by the native accessors to the type used by reflection accessors. E.g., for enums, the reflection accessors use EnumValueDescriptors but the native accessors use the generated enum type.- Specified by:
toReflectionType
in classExtension<ContainingT extends Message,
T>
-
singularToReflectionType
LiketoReflectionType(Object)
, but if the type is a repeated type, this converts a single element.- Specified by:
singularToReflectionType
in classExtension<ContainingT extends Message,
T>
-
getNumber
public int getNumber()- Specified by:
getNumber
in classcom.google.protobuf.ExtensionLite<ContainingT extends Message,
T>
-
getLiteType
public com.google.protobuf.WireFormat.FieldType getLiteType()- Specified by:
getLiteType
in classcom.google.protobuf.ExtensionLite<ContainingT extends Message,
T>
-
isRepeated
public boolean isRepeated()- Specified by:
isRepeated
in classcom.google.protobuf.ExtensionLite<ContainingT extends Message,
T>
-
getDefaultValue
- Specified by:
getDefaultValue
in classcom.google.protobuf.ExtensionLite<ContainingT extends Message,
T>
-