public static class GeneratedMessage.GeneratedExtension<ContainingType extends Message,Type> extends Extension<ContainingType,Type>
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
.
Extension.ExtensionType, Extension.MessageType
Modifier and Type | Method and Description |
---|---|
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.
|
Type |
getDefaultValue()
Returns the default value of the extension field.
|
Descriptors.FieldDescriptor |
getDescriptor()
Returns the descriptor of the extension.
|
protected Extension.ExtensionType |
getExtensionType() |
WireFormat.FieldType |
getLiteType()
Returns the type of the field.
|
Message |
getMessageDefaultInstance()
If the extension is an embedded message or group, returns the default
instance of the message.
|
int |
getNumber()
Returns the field number of the extension.
|
void |
internalInit(Descriptors.FieldDescriptor descriptor)
For use by generated code only.
|
boolean |
isRepeated()
Returns whether it is a repeated field.
|
protected java.lang.Object |
singularFromReflectionType(java.lang.Object value)
Like
fromReflectionType(Object) , but if the type is a repeated
type, this converts a single element. |
protected java.lang.Object |
singularToReflectionType(java.lang.Object value)
Like
toReflectionType(Object) , but if the type is a repeated
type, this converts a single element. |
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.
|
getMessageType
public void internalInit(Descriptors.FieldDescriptor descriptor)
public Descriptors.FieldDescriptor getDescriptor()
Extension
getDescriptor
in class Extension<ContainingType extends Message,Type>
public Message getMessageDefaultInstance()
getMessageDefaultInstance
in class ExtensionLite<ContainingType extends Message,Type>
protected Extension.ExtensionType getExtensionType()
getExtensionType
in class Extension<ContainingType extends Message,Type>
protected java.lang.Object fromReflectionType(java.lang.Object value)
fromReflectionType
in class Extension<ContainingType extends Message,Type>
protected java.lang.Object singularFromReflectionType(java.lang.Object value)
fromReflectionType(Object)
, but if the type is a repeated
type, this converts a single element.singularFromReflectionType
in class Extension<ContainingType extends Message,Type>
protected java.lang.Object toReflectionType(java.lang.Object value)
toReflectionType
in class Extension<ContainingType extends Message,Type>
protected java.lang.Object singularToReflectionType(java.lang.Object value)
toReflectionType(Object)
, but if the type is a repeated
type, this converts a single element.singularToReflectionType
in class Extension<ContainingType extends Message,Type>
public int getNumber()
ExtensionLite
getNumber
in class ExtensionLite<ContainingType extends Message,Type>
public WireFormat.FieldType getLiteType()
ExtensionLite
getLiteType
in class ExtensionLite<ContainingType extends Message,Type>
public boolean isRepeated()
ExtensionLite
isRepeated
in class ExtensionLite<ContainingType extends Message,Type>
public Type getDefaultValue()
ExtensionLite
getDefaultValue
in class ExtensionLite<ContainingType extends Message,Type>