Package com.google.protobuf
Class MessageReflection.ExtensionAdapter
java.lang.Object
com.google.protobuf.MessageReflection.ExtensionAdapter
- All Implemented Interfaces:
MessageReflection.MergeTarget
- Enclosing class:
- MessageReflection
static class MessageReflection.ExtensionAdapter
extends Object
implements MessageReflection.MergeTarget
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.protobuf.MessageReflection.MergeTarget
MessageReflection.MergeTarget.ContainerType -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRepeatedField(Descriptors.FieldDescriptor field, Object value) LikesetRepeatedField, but appends the value as a new element.Clears the field.Clears the oneof.findExtensionByName(ExtensionRegistry registry, String name) findExtensionByNumber(ExtensionRegistry registry, Descriptors.Descriptor containingType, int fieldNumber) finish()Finishes the merge and returns the underlying object.Returns the descriptor for the target.Obtains the value of the given field, or the default value if it is not set.Obtains the FieldDescriptor if the given oneof is set.getUtf8Validation(Descriptors.FieldDescriptor descriptor) Returns the UTF8 validation level for the field.booleanReturns true if the given field is set.booleanReturns true if the given oneof is set.voidmergeGroup(CodedInputStream input, ExtensionRegistryLite extensionRegistry, Descriptors.FieldDescriptor field, Message defaultInstance) Read the given group field from the wire, merging with the existing field if it is already present.voidmergeMessage(CodedInputStream input, ExtensionRegistryLite extensionRegistry, Descriptors.FieldDescriptor field, Message defaultInstance) Read the given message field from the wire, merging with the existing field if it is already present.newEmptyTargetForField(Descriptors.FieldDescriptor descriptor, Message defaultInstance) Returns an empty merge target for a sub-field.newMergeTargetForField(Descriptors.FieldDescriptor descriptor, Message defaultInstance) Returns a new merge target for a sub-field.parseGroup(CodedInputStream input, ExtensionRegistryLite registry, Descriptors.FieldDescriptor field, Message defaultInstance) Parse the input stream into a sub field group defined based on either FieldDescriptor or the default instance.parseMessage(CodedInputStream input, ExtensionRegistryLite registry, Descriptors.FieldDescriptor field, Message defaultInstance) Parse the input stream into a sub field message defined based on either FieldDescriptor or the default instance.parseMessageFromBytes(ByteString bytes, ExtensionRegistryLite registry, Descriptors.FieldDescriptor field, Message defaultInstance) Parse from a ByteString into a sub field message defined based on either FieldDescriptor or the default instance.setField(Descriptors.FieldDescriptor field, Object value) Sets a field to the given value.setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value) Sets an element of a repeated field to the given value.
-
Field Details
-
extensions
-
-
Constructor Details
-
ExtensionAdapter
ExtensionAdapter(FieldSet<Descriptors.FieldDescriptor> extensions)
-
-
Method Details
-
getDescriptorForType
Description copied from interface:MessageReflection.MergeTargetReturns the descriptor for the target.- Specified by:
getDescriptorForTypein interfaceMessageReflection.MergeTarget
-
getField
Description copied from interface:MessageReflection.MergeTargetObtains the value of the given field, or the default value if it is not set. For primitive fields, the boxed primitive value is returned. For enum fields, the EnumValueDescriptor for the value is returned. For embedded message fields, the sub-message is returned. For repeated fields, a java.util.List is returned.- Specified by:
getFieldin interfaceMessageReflection.MergeTarget
-
hasField
Description copied from interface:MessageReflection.MergeTargetReturns true if the given field is set. This is exactly equivalent to calling the generated "has" accessor method corresponding to the field.- Specified by:
hasFieldin interfaceMessageReflection.MergeTarget
-
setField
Description copied from interface:MessageReflection.MergeTargetSets a field to the given value. The value must be of the correct type for this field, i.e. the same type thatMessageOrBuilder.getField(Descriptors.FieldDescriptor)would return.- Specified by:
setFieldin interfaceMessageReflection.MergeTarget
-
clearField
Description copied from interface:MessageReflection.MergeTargetClears the field. This is exactly equivalent to calling the generated "clear" accessor method corresponding to the field.- Specified by:
clearFieldin interfaceMessageReflection.MergeTarget
-
setRepeatedField
public MessageReflection.MergeTarget setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value) Description copied from interface:MessageReflection.MergeTargetSets an element of a repeated field to the given value. The value must be of the correct type for this field, i.e. the same type thatMessageOrBuilder.getRepeatedField(Descriptors.FieldDescriptor, int)would return.- Specified by:
setRepeatedFieldin interfaceMessageReflection.MergeTarget
-
addRepeatedField
public MessageReflection.MergeTarget addRepeatedField(Descriptors.FieldDescriptor field, Object value) Description copied from interface:MessageReflection.MergeTargetLikesetRepeatedField, but appends the value as a new element.- Specified by:
addRepeatedFieldin interfaceMessageReflection.MergeTarget
-
hasOneof
Description copied from interface:MessageReflection.MergeTargetReturns true if the given oneof is set.- Specified by:
hasOneofin interfaceMessageReflection.MergeTarget
-
clearOneof
Description copied from interface:MessageReflection.MergeTargetClears the oneof. This is exactly equivalent to calling the generated "clear" accessor method corresponding to the oneof.- Specified by:
clearOneofin interfaceMessageReflection.MergeTarget
-
getOneofFieldDescriptor
Description copied from interface:MessageReflection.MergeTargetObtains the FieldDescriptor if the given oneof is set. Returns null if no field is set.- Specified by:
getOneofFieldDescriptorin interfaceMessageReflection.MergeTarget
-
getContainerType
- Specified by:
getContainerTypein interfaceMessageReflection.MergeTarget
-
findExtensionByName
- Specified by:
findExtensionByNamein interfaceMessageReflection.MergeTarget
-
findExtensionByNumber
public ExtensionRegistry.ExtensionInfo findExtensionByNumber(ExtensionRegistry registry, Descriptors.Descriptor containingType, int fieldNumber) - Specified by:
findExtensionByNumberin interfaceMessageReflection.MergeTarget
-
parseGroup
public Object parseGroup(CodedInputStream input, ExtensionRegistryLite registry, Descriptors.FieldDescriptor field, Message defaultInstance) throws IOException Description copied from interface:MessageReflection.MergeTargetParse the input stream into a sub field group defined based on either FieldDescriptor or the default instance.- Specified by:
parseGroupin interfaceMessageReflection.MergeTarget- Throws:
IOException
-
parseMessage
public Object parseMessage(CodedInputStream input, ExtensionRegistryLite registry, Descriptors.FieldDescriptor field, Message defaultInstance) throws IOException Description copied from interface:MessageReflection.MergeTargetParse the input stream into a sub field message defined based on either FieldDescriptor or the default instance.- Specified by:
parseMessagein interfaceMessageReflection.MergeTarget- Throws:
IOException
-
mergeGroup
public void mergeGroup(CodedInputStream input, ExtensionRegistryLite extensionRegistry, Descriptors.FieldDescriptor field, Message defaultInstance) throws IOException Description copied from interface:MessageReflection.MergeTargetRead the given group field from the wire, merging with the existing field if it is already present.For extensions, defaultInstance must be specified. For regular fields, defaultInstance can be null.
- Specified by:
mergeGroupin interfaceMessageReflection.MergeTarget- Throws:
IOException
-
mergeMessage
public void mergeMessage(CodedInputStream input, ExtensionRegistryLite extensionRegistry, Descriptors.FieldDescriptor field, Message defaultInstance) throws IOException Description copied from interface:MessageReflection.MergeTargetRead the given message field from the wire, merging with the existing field if it is already present.For extensions, defaultInstance must be specified. For regular fields, defaultInstance can be null.
- Specified by:
mergeMessagein interfaceMessageReflection.MergeTarget- Throws:
IOException
-
parseMessageFromBytes
public Object parseMessageFromBytes(ByteString bytes, ExtensionRegistryLite registry, Descriptors.FieldDescriptor field, Message defaultInstance) throws IOException Description copied from interface:MessageReflection.MergeTargetParse from a ByteString into a sub field message defined based on either FieldDescriptor or the default instance. There isn't a varint indicating the length of the message at the beginning of the input ByteString.- Specified by:
parseMessageFromBytesin interfaceMessageReflection.MergeTarget- Throws:
IOException
-
newMergeTargetForField
public MessageReflection.MergeTarget newMergeTargetForField(Descriptors.FieldDescriptor descriptor, Message defaultInstance) Description copied from interface:MessageReflection.MergeTargetReturns a new merge target for a sub-field. When defaultInstance is provided, it indicates the descriptor is for an extension type, and implementations should create a new instance from the defaultInstance prototype directly.- Specified by:
newMergeTargetForFieldin interfaceMessageReflection.MergeTarget
-
newEmptyTargetForField
public MessageReflection.MergeTarget newEmptyTargetForField(Descriptors.FieldDescriptor descriptor, Message defaultInstance) Description copied from interface:MessageReflection.MergeTargetReturns an empty merge target for a sub-field. When defaultInstance is provided, it indicates the descriptor is for an extension type, and implementations should create a new instance from the defaultInstance prototype directly.- Specified by:
newEmptyTargetForFieldin interfaceMessageReflection.MergeTarget
-
getUtf8Validation
Description copied from interface:MessageReflection.MergeTargetReturns the UTF8 validation level for the field.- Specified by:
getUtf8Validationin interfaceMessageReflection.MergeTarget
-
finish
Description copied from interface:MessageReflection.MergeTargetFinishes the merge and returns the underlying object.- Specified by:
finishin interfaceMessageReflection.MergeTarget
-