Package com.google.protobuf
Class GeneratedMessage.GeneratedExtension<ContainingT extends Message,T>
- java.lang.Object
-
- com.google.protobuf.ExtensionLite<ContainingType,Type>
-
- 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
.protofile:option java_class = "MyProto"; message Foo { extensions 1000 to max; } extend Foo { optional int32 bar; }Then,
MyProto.Foo.barhas typeGeneratedExtension<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.ExtendableMessageandGeneratedMessage.ExtendableBuilder.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.protobuf.Extension
Extension.ExtensionType, Extension.MessageType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectfromReflectionType(java.lang.Object value)Convert from the type used by the reflection accessors to the type used by native accessors.TgetDefaultValue()Descriptors.FieldDescriptorgetDescriptor()Returns the descriptor of the extension.protected Extension.ExtensionTypegetExtensionType()com.google.protobuf.WireFormat.FieldTypegetLiteType()MessagegetMessageDefaultInstance()If the extension is an embedded message or group, returns the default instance of the message.intgetNumber()voidinternalInit(Descriptors.FieldDescriptor descriptor)For use by generated code only.booleanisRepeated()protected java.lang.ObjectsingularFromReflectionType(java.lang.Object value)LikefromReflectionType(Object), but if the type is a repeated type, this converts a single element.protected java.lang.ObjectsingularToReflectionType(java.lang.Object value)LiketoReflectionType(Object), but if the type is a repeated type, this converts a single element.protected java.lang.ObjecttoReflectionType(java.lang.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 Detail
-
internalInit
public void internalInit(Descriptors.FieldDescriptor descriptor)
For use by generated code only.
-
getDescriptor
public Descriptors.FieldDescriptor getDescriptor()
Description copied from class:ExtensionReturns the descriptor of the extension.- Specified by:
getDescriptorin classExtension<ContainingT extends Message,T>
-
getMessageDefaultInstance
public Message getMessageDefaultInstance()
If the extension is an embedded message or group, returns the default instance of the message.- Specified by:
getMessageDefaultInstancein classExtension<ContainingT extends Message,T>
-
getExtensionType
protected Extension.ExtensionType getExtensionType()
- Specified by:
getExtensionTypein classExtension<ContainingT extends Message,T>
-
fromReflectionType
protected java.lang.Object fromReflectionType(java.lang.Object value)
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<ContainingT extends Message,T>
-
singularFromReflectionType
protected java.lang.Object singularFromReflectionType(java.lang.Object value)
LikefromReflectionType(Object), but if the type is a repeated type, this converts a single element.- Specified by:
singularFromReflectionTypein classExtension<ContainingT extends Message,T>
-
toReflectionType
protected java.lang.Object toReflectionType(java.lang.Object value)
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<ContainingT extends Message,T>
-
singularToReflectionType
protected java.lang.Object singularToReflectionType(java.lang.Object value)
LiketoReflectionType(Object), but if the type is a repeated type, this converts a single element.- Specified by:
singularToReflectionTypein classExtension<ContainingT extends Message,T>
-
getNumber
public int getNumber()
- Specified by:
getNumberin classcom.google.protobuf.ExtensionLite<ContainingT extends Message,T>
-
getLiteType
public com.google.protobuf.WireFormat.FieldType getLiteType()
- Specified by:
getLiteTypein classcom.google.protobuf.ExtensionLite<ContainingT extends Message,T>
-
isRepeated
public boolean isRepeated()
- Specified by:
isRepeatedin classcom.google.protobuf.ExtensionLite<ContainingT extends Message,T>
-
getDefaultValue
public T getDefaultValue()
- Specified by:
getDefaultValuein classcom.google.protobuf.ExtensionLite<ContainingT extends Message,T>
-
-