Package com.google.protobuf
Class DescriptorMessageInfoFactory
java.lang.Object
com.google.protobuf.DescriptorMessageInfoFactory
- All Implemented Interfaces:
MessageInfoFactory
@ExperimentalApi
final class DescriptorMessageInfoFactory
extends Object
implements MessageInfoFactory
A factory for message info based on protobuf descriptors for a
GeneratedMessageV3
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
A helper class to determine whether a message type needs to implementisInitialized()
.private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final DescriptorMessageInfoFactory
private static DescriptorMessageInfoFactory.IsInitializedCheckAnalyzer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Field
private static FieldInfo
buildOneofMember
(Class<?> messageType, Descriptors.FieldDescriptor fd, DescriptorMessageInfoFactory.OneofState oneofState, boolean enforceUtf8, Internal.EnumVerifier enumVerifier) Builds info for a oneof member field.private static Field
cachedSizeField
(Class<?> messageType, Descriptors.FieldDescriptor fd) private static MessageInfo
convert
(Class<?> messageType, Descriptors.Descriptor messageDescriptor) private static StructuralMessageInfo
convertProto2
(Class<?> messageType, Descriptors.Descriptor messageDescriptor) private static StructuralMessageInfo
convertProto3
(Class<?> messageType, Descriptors.Descriptor messageDescriptor) private static Descriptors.Descriptor
descriptorForType
(Class<?> messageType) private static Field
field
(Class<?> messageType, Descriptors.FieldDescriptor fd) private static Field
private static String
private static Message
getDefaultInstance
(Class<?> messageType) (package private) static String
private static FieldType
static DescriptorMessageInfoFactory
private static Class
<?> getOneofStoredType
(Class<?> messageType, Descriptors.FieldDescriptor fd, FieldType type) private static Class
<?> getOneofStoredTypeForMessage
(Class<?> messageType, Descriptors.FieldDescriptor fd) Inspects the message to identify the stored type for a message field that is part of a oneof.private static String
getterForField
(String snakeCase) Constructs the name of the get method for the given field in the proto.private static Class
<?> getTypeForRepeatedMessageField
(Class<?> messageType, Descriptors.FieldDescriptor fd) Inspects the message to identify the message type of a repeated message field.boolean
isSupported
(Class<?> messageType) Whether the message class is supported by this factory.messageInfoFor
(Class<?> messageType) Returns a information of the message class.private static boolean
needsIsInitializedCheck
(Descriptors.Descriptor descriptor) private static String
snakeCaseToCamelCase
(String snakeCase) This method must match exactly with the corresponding function in protocol compiler.
-
Field Details
-
GET_DEFAULT_INSTANCE_METHOD_NAME
- See Also:
-
instance
-
specialFieldNames
-
isInitializedCheckAnalyzer
-
-
Constructor Details
-
DescriptorMessageInfoFactory
private DescriptorMessageInfoFactory()
-
-
Method Details
-
getInstance
-
isSupported
Description copied from interface:MessageInfoFactory
Whether the message class is supported by this factory.- Specified by:
isSupported
in interfaceMessageInfoFactory
-
messageInfoFor
Description copied from interface:MessageInfoFactory
Returns a information of the message class.- Specified by:
messageInfoFor
in interfaceMessageInfoFactory
-
getDefaultInstance
-
descriptorForType
-
convert
-
needsIsInitializedCheck
-
convertProto2
private static StructuralMessageInfo convertProto2(Class<?> messageType, Descriptors.Descriptor messageDescriptor) -
convertProto3
private static StructuralMessageInfo convertProto3(Class<?> messageType, Descriptors.Descriptor messageDescriptor) -
buildOneofMember
private static FieldInfo buildOneofMember(Class<?> messageType, Descriptors.FieldDescriptor fd, DescriptorMessageInfoFactory.OneofState oneofState, boolean enforceUtf8, Internal.EnumVerifier enumVerifier) Builds info for a oneof member field. -
getOneofStoredType
private static Class<?> getOneofStoredType(Class<?> messageType, Descriptors.FieldDescriptor fd, FieldType type) -
getFieldType
-
bitField
-
field
-
cachedSizeField
-
field
-
getFieldName
-
getCachedSizeFieldName
-
snakeCaseToCamelCase
This method must match exactly with the corresponding function in protocol compiler. See: https://github.com/google/protobuf/blob/v3.0.0/src/google/protobuf/compiler/java/java_helpers.cc#L153 -
getOneofStoredTypeForMessage
private static Class<?> getOneofStoredTypeForMessage(Class<?> messageType, Descriptors.FieldDescriptor fd) Inspects the message to identify the stored type for a message field that is part of a oneof. -
getTypeForRepeatedMessageField
private static Class<?> getTypeForRepeatedMessageField(Class<?> messageType, Descriptors.FieldDescriptor fd) Inspects the message to identify the message type of a repeated message field. -
getterForField
Constructs the name of the get method for the given field in the proto.
-