Class MessageSetSchema<T>
java.lang.Object
com.google.protobuf.MessageSetSchema<T>
- All Implemented Interfaces:
Schema<T>
Schema used for proto2 messages using message_set_wireformat.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MessageLiteprivate final ExtensionSchema<?> private final booleanprivate final UnknownFieldSchema<?, ?> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMessageSetSchema(UnknownFieldSchema<?, ?> unknownFieldSchema, ExtensionSchema<?> extensionSchema, MessageLite defaultInstance) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine of the two messages are equal.intgetSerializedSize(T message) Compute the serialized size of the message.private <UT,UB> int getUnknownFieldsSerializedSize(UnknownFieldSchema<UT, UB> schema, T message) intCompute a hashCode for the message.final booleanisInitialized(T message) Checks whether all required fields are set.voidmakeImmutable(T message) Marks repeated/map/extension/unknown fields as immutable.voidmergeFrom(T message, byte[] data, int position, int limit, ArrayDecoders.Registers registers) Like the above but parses from a byte[] without extensions.voidmergeFrom(T message, CodedInputStreamReader reader, ExtensionRegistryLite extensionRegistry) Reads fields from the givenCodedInputStreamReaderand merges them into the message.voidMerge values fromotherintomessage.private <UT, UB, ET extends FieldSet.FieldDescriptorLite<ET>>
voidmergeFromHelper(UnknownFieldSchema<UT, UB> unknownFieldSchema, ExtensionSchema<ET> extensionSchema, T message, CodedInputStreamReader reader, ExtensionRegistryLite extensionRegistry) A helper method for wildcard capture ofunknownFieldSchema.Creates a new instance of the message class.(package private) static <T> MessageSetSchema<T> newSchema(UnknownFieldSchema<?, ?> unknownFieldSchema, ExtensionSchema<?> extensionSchema, MessageLite defaultInstance) private <UT, UB, ET extends FieldSet.FieldDescriptorLite<ET>>
booleanparseMessageSetItemOrUnknownField(CodedInputStreamReader reader, ExtensionRegistryLite extensionRegistry, ExtensionSchema<ET> extensionSchema, FieldSet<ET> extensions, UnknownFieldSchema<UT, UB> unknownFieldSchema, UB unknownFields) voidwriteTo(T message, CodedOutputStreamWriter writer) Writes the given message to the targetCodedOutputStreamWriter.private <UT,UB> void writeUnknownFieldsHelper(UnknownFieldSchema<UT, UB> unknownFieldSchema, T message, CodedOutputStreamWriter writer) A helper method for wildcard capture ofunknownFieldSchema.
-
Field Details
-
defaultInstance
-
unknownFieldSchema
-
hasExtensions
private final boolean hasExtensions -
extensionSchema
-
-
Constructor Details
-
MessageSetSchema
private MessageSetSchema(UnknownFieldSchema<?, ?> unknownFieldSchema, ExtensionSchema<?> extensionSchema, MessageLite defaultInstance)
-
-
Method Details
-
newSchema
static <T> MessageSetSchema<T> newSchema(UnknownFieldSchema<?, ?> unknownFieldSchema, ExtensionSchema<?> extensionSchema, MessageLite defaultInstance) -
newInstance
Description copied from interface:SchemaCreates a new instance of the message class.- Specified by:
newInstancein interfaceSchema<T>
-
equals
-
hashCode
-
mergeFrom
-
writeTo
Description copied from interface:SchemaWrites the given message to the targetCodedOutputStreamWriter.- Specified by:
writeToin interfaceSchema<T>- Throws:
IOException
-
writeUnknownFieldsHelper
private <UT,UB> void writeUnknownFieldsHelper(UnknownFieldSchema<UT, UB> unknownFieldSchema, T message, CodedOutputStreamWriter writer) throws IOExceptionA helper method for wildcard capture ofunknownFieldSchema. See: https://docs.oracle.com/javase/tutorial/java/generics/capture.html- Throws:
IOException
-
mergeFrom
public void mergeFrom(T message, byte[] data, int position, int limit, ArrayDecoders.Registers registers) throws IOException Description copied from interface:SchemaLike the above but parses from a byte[] without extensions. Entry point of fast path. Note that this method may throw IndexOutOfBoundsException if the input data is not valid protobuf wire format. Protobuf public API methods should catch and convert that exception to InvalidProtocolBufferException.- Specified by:
mergeFromin interfaceSchema<T>- Throws:
IOException
-
mergeFrom
public void mergeFrom(T message, CodedInputStreamReader reader, ExtensionRegistryLite extensionRegistry) throws IOException Description copied from interface:SchemaReads fields from the givenCodedInputStreamReaderand merges them into the message. It doesn't make the message immutable after parsing is done. To make the message immutable, useSchema.makeImmutable(T).- Specified by:
mergeFromin interfaceSchema<T>- Throws:
IOException
-
mergeFromHelper
private <UT, UB, ET extends FieldSet.FieldDescriptorLite<ET>> void mergeFromHelper(UnknownFieldSchema<UT, UB> unknownFieldSchema, ExtensionSchema<ET> extensionSchema, T message, CodedInputStreamReader reader, ExtensionRegistryLite extensionRegistry) throws IOExceptionA helper method for wildcard capture ofunknownFieldSchema. See: https://docs.oracle.com/javase/tutorial/java/generics/capture.html- Throws:
IOException
-
makeImmutable
Description copied from interface:SchemaMarks repeated/map/extension/unknown fields as immutable.- Specified by:
makeImmutablein interfaceSchema<T>
-
parseMessageSetItemOrUnknownField
private <UT, UB, ET extends FieldSet.FieldDescriptorLite<ET>> boolean parseMessageSetItemOrUnknownField(CodedInputStreamReader reader, ExtensionRegistryLite extensionRegistry, ExtensionSchema<ET> extensionSchema, FieldSet<ET> extensions, UnknownFieldSchema<UT, UB> unknownFieldSchema, UB unknownFields) throws IOException- Throws:
IOException
-
isInitialized
Description copied from interface:SchemaChecks whether all required fields are set.- Specified by:
isInitializedin interfaceSchema<T>
-
getSerializedSize
Description copied from interface:SchemaCompute the serialized size of the message.- Specified by:
getSerializedSizein interfaceSchema<T>
-
getUnknownFieldsSerializedSize
-