Package com.google.protobuf
Class GeneratedMessage.GeneratedExtension<ContainingType extends Message,Type>
java.lang.Object
com.google.protobuf.Extension<ContainingType,Type>
com.google.protobuf.GeneratedMessage.GeneratedExtension<ContainingType,Type>
- Enclosing class:
- GeneratedMessage
public static class GeneratedMessage.GeneratedExtension<ContainingType extends Message,Type>
extends Extension<ContainingType,Type>
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 ObjectfromReflectionType(Object value) Convert from the type used by the reflection accessors to the type used by native accessors.Returns the default value of the extension field.Returns the descriptor of the extension.protected Extension.ExtensionTypeReturns the type of the field.If the extension is an embedded message or group, returns the default instance of the message.intReturns the field number of the extension.voidinternalInit(Descriptors.FieldDescriptor descriptor) For use by generated code only.booleanReturns whether it is a repeated field.protected ObjectsingularFromReflectionType(Object value) LikefromReflectionType(Object), but if the type is a repeated type, this converts a single element.protected ObjectsingularToReflectionType(Object value) LiketoReflectionType(Object), but if the type is a repeated type, this converts a single element.protected ObjecttoReflectionType(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:ExtensionReturns the descriptor of the extension.- Specified by:
getDescriptorin classExtension<ContainingType extends Message,Type>
-
getMessageDefaultInstance
If the extension is an embedded message or group, returns the default instance of the message.- Specified by:
getMessageDefaultInstancein classExtension<ContainingType extends Message,Type>
-
getExtensionType
- Overrides:
getExtensionTypein classExtension<ContainingType extends Message,Type>
-
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:
fromReflectionTypein classExtension<ContainingType extends Message,Type>
-
singularFromReflectionType
LikefromReflectionType(Object), but if the type is a repeated type, this converts a single element.- Specified by:
singularFromReflectionTypein classExtension<ContainingType extends Message,Type>
-
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:
toReflectionTypein classExtension<ContainingType extends Message,Type>
-
singularToReflectionType
LiketoReflectionType(Object), but if the type is a repeated type, this converts a single element.- Specified by:
singularToReflectionTypein classExtension<ContainingType extends Message,Type>
-
getNumber
public int getNumber()Description copied from class:ExtensionReturns the field number of the extension.- Specified by:
getNumberin classExtension<ContainingType extends Message,Type>
-
getLiteType
Description copied from class:ExtensionReturns the type of the field.- Specified by:
getLiteTypein classExtension<ContainingType extends Message,Type>
-
isRepeated
public boolean isRepeated()Description copied from class:ExtensionReturns whether it is a repeated field.- Specified by:
isRepeatedin classExtension<ContainingType extends Message,Type>
-
getDefaultValue
Description copied from class:ExtensionReturns the default value of the extension field.- Specified by:
getDefaultValuein classExtension<ContainingType extends Message,Type>
-