Class SchemaUtil
java.lang.Object
com.google.protobuf.SchemaUtil
Helper methods used by schemas.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final Class<?> private static final UnknownFieldSchema<?, ?> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static intcomputeGroupSize(int fieldNumber, MessageLite value, Schema schema) Deprecated.groups are deprecated.(package private) static intcomputeGroupSizeNoTag(MessageLite value, Schema schema) Deprecated.groups are deprecated.(package private) static intcomputeMessageSize(int fieldNumber, AbstractMessageLite value, Schema schema) Compute the number of bytes that would be needed to encode an embedded message field, including tag.(package private) static intcomputeMessageSizeNoTag(AbstractMessageLite value, Schema schema) Compute the number of bytes that would be needed to encode an embedded message field.(package private) static intcomputeSizeBoolList(int fieldNumber, List<?> list, boolean packed) (package private) static intcomputeSizeBoolListNoTag(List<?> list) (package private) static intcomputeSizeByteStringList(int fieldNumber, List<ByteString> list) (package private) static intcomputeSizeEnumList(int fieldNumber, List<Integer> list, boolean packed) (package private) static intcomputeSizeEnumListNoTag(List<Integer> list) (package private) static intcomputeSizeFixed32List(int fieldNumber, List<?> list, boolean packed) (package private) static intcomputeSizeFixed32ListNoTag(List<?> list) (package private) static intcomputeSizeFixed64List(int fieldNumber, List<?> list, boolean packed) (package private) static intcomputeSizeFixed64ListNoTag(List<?> list) (package private) static intcomputeSizeGroupList(int fieldNumber, List<MessageLite> list) (package private) static intcomputeSizeGroupList(int fieldNumber, List<MessageLite> list, Schema<?> schema) (package private) static intcomputeSizeInt32List(int fieldNumber, List<Integer> list, boolean packed) (package private) static intcomputeSizeInt32ListNoTag(List<Integer> list) (package private) static intcomputeSizeInt64List(int fieldNumber, List<Long> list, boolean packed) (package private) static intcomputeSizeInt64ListNoTag(List<Long> list) (package private) static intcomputeSizeMessage(int fieldNumber, Object value, Schema<?> schema) (package private) static intcomputeSizeMessageList(int fieldNumber, List<?> list) (package private) static intcomputeSizeMessageList(int fieldNumber, List<?> list, Schema<?> schema) (package private) static intcomputeSizeSInt32List(int fieldNumber, List<Integer> list, boolean packed) (package private) static int(package private) static intcomputeSizeSInt64List(int fieldNumber, List<Long> list, boolean packed) (package private) static intcomputeSizeSInt64ListNoTag(List<Long> list) (package private) static intcomputeSizeStringList(int fieldNumber, List<?> list) (package private) static intcomputeSizeUInt32List(int fieldNumber, List<Integer> list, boolean packed) (package private) static int(package private) static intcomputeSizeUInt64List(int fieldNumber, List<Long> list, boolean packed) (package private) static intcomputeSizeUInt64ListNoTag(List<Long> list) (package private) static <UT,UB> UB filterUnknownEnumList(Object containerMessage, int number, List<Integer> enumList, Internal.EnumLiteMap<?> enumMap, UB unknownFields, UnknownFieldSchema<UT, UB> unknownFieldSchema) Filters unrecognized enum values in a list.(package private) static <UT,UB> UB filterUnknownEnumList(Object containerMessage, int number, List<Integer> enumList, Internal.EnumVerifier enumVerifier, UB unknownFields, UnknownFieldSchema<UT, UB> unknownFieldSchema) Filters unrecognized enum values in a list.private static Class<?> (package private) static ObjectgetMapDefaultEntry(Class<?> clazz, String name) (package private) static <T, FT extends FieldSet.FieldDescriptorLite<FT>>
voidmergeExtensions(ExtensionSchema<FT> schema, T message, T other) (package private) static <T> voidmergeMap(MapFieldSchema mapFieldSchema, T message, T o, long offset) (package private) static <T,UT, UB> void mergeUnknownFields(UnknownFieldSchema<UT, UB> schema, T message, T other) static voidrequireGeneratedMessage(Class<?> messageType) Requires that the given message extendGeneratedMessageorGeneratedMessageLite.(package private) static booleansafeEquals(Object a, Object b) Returns true if both are null or both areObject.equals(Object).static booleanshouldUseTableSwitch(int lo, int hi, int numFields) Determines whether to issue tableswitch or lookupswitch for the mergeFrom method.static booleanshouldUseTableSwitch(FieldInfo[] fields) Determines whether to issue tableswitch or lookupswitch for the mergeFrom method.(package private) static <UT,UB> UB storeUnknownEnum(Object containerMessage, int number, int enumValue, UB unknownFields, UnknownFieldSchema<UT, UB> unknownFieldSchema) Stores an unrecognized enum value as an unknown value.(package private) static StringtoCamelCase(String name, boolean capNext) static UnknownFieldSchema<?, ?> static voidwriteBool(int fieldNumber, boolean value, CodedOutputStreamWriter writer) static voidwriteBoolList(int fieldNumber, List<Boolean> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteBytes(int fieldNumber, ByteString value, CodedOutputStreamWriter writer) static voidwriteBytesList(int fieldNumber, List<ByteString> value, CodedOutputStreamWriter writer) static voidwriteDouble(int fieldNumber, double value, CodedOutputStreamWriter writer) static voidwriteDoubleList(int fieldNumber, List<Double> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteEnum(int fieldNumber, int value, CodedOutputStreamWriter writer) static voidwriteEnumList(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteFixed32(int fieldNumber, int value, CodedOutputStreamWriter writer) static voidwriteFixed32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteFixed64(int fieldNumber, long value, CodedOutputStreamWriter writer) static voidwriteFixed64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteFloat(int fieldNumber, float value, CodedOutputStreamWriter writer) static voidwriteFloatList(int fieldNumber, List<Float> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteGroupList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer) static voidwriteGroupList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer, Schema<?> schema) static voidwriteInt32(int fieldNumber, int value, CodedOutputStreamWriter writer) static voidwriteInt32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteInt64(int fieldNumber, long value, CodedOutputStreamWriter writer) static voidwriteInt64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteLazyFieldList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer) static voidwriteMessage(int fieldNumber, Object value, CodedOutputStreamWriter writer) static voidwriteMessageList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer) static voidwriteMessageList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer, Schema<?> schema) static voidwriteSFixed32(int fieldNumber, int value, CodedOutputStreamWriter writer) static voidwriteSFixed32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteSFixed64(int fieldNumber, long value, CodedOutputStreamWriter writer) static voidwriteSFixed64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteSInt32(int fieldNumber, int value, CodedOutputStreamWriter writer) static voidwriteSInt32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteSInt64(int fieldNumber, long value, CodedOutputStreamWriter writer) static voidwriteSInt64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteString(int fieldNumber, Object value, CodedOutputStreamWriter writer) private static voidwriteStringInternal(int fieldNumber, String value, CodedOutputStreamWriter writer) static voidwriteStringList(int fieldNumber, List<String> value, CodedOutputStreamWriter writer) static voidwriteUInt32(int fieldNumber, int value, CodedOutputStreamWriter writer) static voidwriteUInt32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) static voidwriteUInt64(int fieldNumber, long value, CodedOutputStreamWriter writer) static voidwriteUInt64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed)
-
Field Details
-
GENERATED_MESSAGE_CLASS
-
UNKNOWN_FIELD_SET_LITE_SCHEMA
-
DEFAULT_LOOK_UP_START_NUMBER
private static final int DEFAULT_LOOK_UP_START_NUMBER- See Also:
-
-
Constructor Details
-
SchemaUtil
private SchemaUtil()
-
-
Method Details
-
requireGeneratedMessage
Requires that the given message extendGeneratedMessageorGeneratedMessageLite. -
writeDouble
public static void writeDouble(int fieldNumber, double value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeFloat
public static void writeFloat(int fieldNumber, float value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeInt64
public static void writeInt64(int fieldNumber, long value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeUInt64
public static void writeUInt64(int fieldNumber, long value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeSInt64
public static void writeSInt64(int fieldNumber, long value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeFixed64
public static void writeFixed64(int fieldNumber, long value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeSFixed64
public static void writeSFixed64(int fieldNumber, long value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeInt32
public static void writeInt32(int fieldNumber, int value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeUInt32
public static void writeUInt32(int fieldNumber, int value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeSInt32
public static void writeSInt32(int fieldNumber, int value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeFixed32
public static void writeFixed32(int fieldNumber, int value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeSFixed32
public static void writeSFixed32(int fieldNumber, int value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeEnum
public static void writeEnum(int fieldNumber, int value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeBool
public static void writeBool(int fieldNumber, boolean value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeString
public static void writeString(int fieldNumber, Object value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeStringInternal
private static void writeStringInternal(int fieldNumber, String value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeBytes
public static void writeBytes(int fieldNumber, ByteString value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeMessage
public static void writeMessage(int fieldNumber, Object value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeDoubleList
public static void writeDoubleList(int fieldNumber, List<Double> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeFloatList
public static void writeFloatList(int fieldNumber, List<Float> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeInt64List
public static void writeInt64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeUInt64List
public static void writeUInt64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeSInt64List
public static void writeSInt64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeFixed64List
public static void writeFixed64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeSFixed64List
public static void writeSFixed64List(int fieldNumber, List<Long> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeInt32List
public static void writeInt32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeUInt32List
public static void writeUInt32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeSInt32List
public static void writeSInt32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeFixed32List
public static void writeFixed32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeSFixed32List
public static void writeSFixed32List(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeEnumList
public static void writeEnumList(int fieldNumber, List<Integer> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeBoolList
public static void writeBoolList(int fieldNumber, List<Boolean> value, CodedOutputStreamWriter writer, boolean packed) throws IOException - Throws:
IOException
-
writeStringList
public static void writeStringList(int fieldNumber, List<String> value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeBytesList
public static void writeBytesList(int fieldNumber, List<ByteString> value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeMessageList
public static void writeMessageList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeMessageList
public static void writeMessageList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer, Schema<?> schema) throws IOException - Throws:
IOException
-
writeLazyFieldList
public static void writeLazyFieldList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeGroupList
public static void writeGroupList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer) throws IOException - Throws:
IOException
-
writeGroupList
public static void writeGroupList(int fieldNumber, List<?> value, CodedOutputStreamWriter writer, Schema<?> schema) throws IOException - Throws:
IOException
-
computeSizeInt64ListNoTag
-
computeSizeInt64List
-
computeSizeUInt64ListNoTag
-
computeSizeUInt64List
-
computeSizeSInt64ListNoTag
-
computeSizeSInt64List
-
computeSizeEnumListNoTag
-
computeSizeEnumList
-
computeSizeInt32ListNoTag
-
computeSizeInt32List
-
computeSizeUInt32ListNoTag
-
computeSizeUInt32List
-
computeSizeSInt32ListNoTag
-
computeSizeSInt32List
-
computeSizeFixed32ListNoTag
-
computeSizeFixed32List
-
computeSizeFixed64ListNoTag
-
computeSizeFixed64List
-
computeSizeBoolListNoTag
-
computeSizeBoolList
-
computeSizeStringList
-
computeSizeMessage
-
computeMessageSize
Compute the number of bytes that would be needed to encode an embedded message field, including tag. -
computeMessageSizeNoTag
Compute the number of bytes that would be needed to encode an embedded message field. -
computeSizeMessageList
-
computeSizeMessageList
-
computeSizeByteStringList
-
computeGroupSizeNoTag
Deprecated.groups are deprecated.Compute the number of bytes that would be needed to encode agroupfield. -
computeGroupSize
Deprecated.groups are deprecated.Compute the number of bytes that would be needed to encode agroupfield, including tag. -
computeSizeGroupList
-
computeSizeGroupList
-
shouldUseTableSwitch
Determines whether to issue tableswitch or lookupswitch for the mergeFrom method.- See Also:
-
shouldUseTableSwitch
public static boolean shouldUseTableSwitch(int lo, int hi, int numFields) Determines whether to issue tableswitch or lookupswitch for the mergeFrom method. This is based on the logic in the JDK.- Parameters:
lo- the lowest fieldNumber contained within the message.hi- the highest fieldNumber contained within the message.numFields- the total number of fields in the message.- Returns:
trueif tableswitch should be used, rather than lookupswitch.
-
unknownFieldSetLiteSchema
-
getGeneratedMessageClass
-
getMapDefaultEntry
-
toCamelCase
-
safeEquals
Returns true if both are null or both areObject.equals(Object). -
mergeMap
-
mergeExtensions
static <T, FT extends FieldSet.FieldDescriptorLite<FT>> void mergeExtensions(ExtensionSchema<FT> schema, T message, T other) -
mergeUnknownFields
-
filterUnknownEnumList
@CanIgnoreReturnValue static <UT,UB> UB filterUnknownEnumList(Object containerMessage, int number, List<Integer> enumList, Internal.EnumLiteMap<?> enumMap, UB unknownFields, UnknownFieldSchema<UT, UB> unknownFieldSchema) Filters unrecognized enum values in a list. -
filterUnknownEnumList
@CanIgnoreReturnValue static <UT,UB> UB filterUnknownEnumList(Object containerMessage, int number, List<Integer> enumList, Internal.EnumVerifier enumVerifier, UB unknownFields, UnknownFieldSchema<UT, UB> unknownFieldSchema) Filters unrecognized enum values in a list. -
storeUnknownEnum
@CanIgnoreReturnValue static <UT,UB> UB storeUnknownEnum(Object containerMessage, int number, int enumValue, UB unknownFields, UnknownFieldSchema<UT, UB> unknownFieldSchema) Stores an unrecognized enum value as an unknown value.
-