Package com.google.protobuf
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, Reader reader, ExtensionRegistryLite extensionRegistry) Reads fields from the givenReaderand 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, Reader 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(Reader reader, ExtensionRegistryLite extensionRegistry, ExtensionSchema<ET> extensionSchema, FieldSet<ET> extensions, UnknownFieldSchema<UT, UB> unknownFieldSchema, UB unknownFields) voidWrites the given message to the targetWriter.private <UT,UB> void writeUnknownFieldsHelper(UnknownFieldSchema<UT, UB> unknownFieldSchema, T message, Writer 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
Description copied from interface:SchemaDetermine of the two messages are equal. -
hashCode
Description copied from interface:SchemaCompute a hashCode for the message. -
mergeFrom
Description copied from interface:SchemaMerge values fromotherintomessage. This method doesn't make the message immutable. To make the message immutable after merging, useSchema.makeImmutable(T). -
writeTo
Description copied from interface:SchemaWrites the given message to the targetWriter.- Specified by:
writeToin interfaceSchema<T>- Throws:
IOException
-
writeUnknownFieldsHelper
private <UT,UB> void writeUnknownFieldsHelper(UnknownFieldSchema<UT, UB> unknownFieldSchema, T message, Writer 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, Reader reader, ExtensionRegistryLite extensionRegistry) throws IOException Description copied from interface:SchemaReads fields from the givenReaderand 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, void mergeFromHelperET extends FieldSet.FieldDescriptorLite<ET>> (UnknownFieldSchema<UT, UB> unknownFieldSchema, ExtensionSchema<ET> extensionSchema, T message, Reader 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, boolean parseMessageSetItemOrUnknownFieldET extends FieldSet.FieldDescriptorLite<ET>> (Reader 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
-