Package com.google.protobuf
Class SchemaUtil
- java.lang.Object
-
- com.google.protobuf.SchemaUtil
-
@ExperimentalApi @CheckReturnValue final class SchemaUtil extends java.lang.Object
Helper methods used by schemas.
-
-
Field Summary
Fields Modifier and Type Field Description private static intDEFAULT_LOOK_UP_START_NUMBERprivate static java.lang.Class<?>GENERATED_MESSAGE_CLASSprivate static UnknownFieldSchema<?,?>UNKNOWN_FIELD_SET_FULL_SCHEMAprivate static UnknownFieldSchema<?,?>UNKNOWN_FIELD_SET_LITE_SCHEMA
-
Constructor Summary
Constructors Modifier Constructor Description privateSchemaUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static intcomputeSizeBoolList(int fieldNumber, java.util.List<?> list, boolean packed)(package private) static intcomputeSizeBoolListNoTag(java.util.List<?> list)(package private) static intcomputeSizeByteStringList(int fieldNumber, java.util.List<ByteString> list)(package private) static intcomputeSizeEnumList(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)(package private) static intcomputeSizeEnumListNoTag(java.util.List<java.lang.Integer> list)(package private) static intcomputeSizeFixed32List(int fieldNumber, java.util.List<?> list, boolean packed)(package private) static intcomputeSizeFixed32ListNoTag(java.util.List<?> list)(package private) static intcomputeSizeFixed64List(int fieldNumber, java.util.List<?> list, boolean packed)(package private) static intcomputeSizeFixed64ListNoTag(java.util.List<?> list)(package private) static intcomputeSizeGroupList(int fieldNumber, java.util.List<MessageLite> list)(package private) static intcomputeSizeGroupList(int fieldNumber, java.util.List<MessageLite> list, Schema<?> schema)(package private) static intcomputeSizeInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)(package private) static intcomputeSizeInt32ListNoTag(java.util.List<java.lang.Integer> list)(package private) static intcomputeSizeInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)(package private) static intcomputeSizeInt64ListNoTag(java.util.List<java.lang.Long> list)(package private) static intcomputeSizeMessage(int fieldNumber, java.lang.Object value, Schema<?> schema)(package private) static intcomputeSizeMessageList(int fieldNumber, java.util.List<?> list)(package private) static intcomputeSizeMessageList(int fieldNumber, java.util.List<?> list, Schema<?> schema)(package private) static intcomputeSizeSInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)(package private) static intcomputeSizeSInt32ListNoTag(java.util.List<java.lang.Integer> list)(package private) static intcomputeSizeSInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)(package private) static intcomputeSizeSInt64ListNoTag(java.util.List<java.lang.Long> list)(package private) static intcomputeSizeStringList(int fieldNumber, java.util.List<?> list)(package private) static intcomputeSizeUInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)(package private) static intcomputeSizeUInt32ListNoTag(java.util.List<java.lang.Integer> list)(package private) static intcomputeSizeUInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)(package private) static intcomputeSizeUInt64ListNoTag(java.util.List<java.lang.Long> list)(package private) static <UT,UB>
UBfilterUnknownEnumList(java.lang.Object containerMessage, int number, java.util.List<java.lang.Integer> enumList, Internal.EnumLiteMap<?> enumMap, UB unknownFields, UnknownFieldSchema<UT,UB> unknownFieldSchema)Filters unrecognized enum values in a list.(package private) static <UT,UB>
UBfilterUnknownEnumList(java.lang.Object containerMessage, int number, java.util.List<java.lang.Integer> enumList, Internal.EnumVerifier enumVerifier, UB unknownFields, UnknownFieldSchema<UT,UB> unknownFieldSchema)Filters unrecognized enum values in a list.private static java.lang.Class<?>getGeneratedMessageClass()(package private) static java.lang.ObjectgetMapDefaultEntry(java.lang.Class<?> clazz, java.lang.String name)private static UnknownFieldSchema<?,?>getUnknownFieldSetSchema()private static java.lang.Class<?>getUnknownFieldSetSchemaClass()(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>
voidmergeUnknownFields(UnknownFieldSchema<UT,UB> schema, T message, T other)static voidrequireGeneratedMessage(java.lang.Class<?> messageType)Requires that the given message extendGeneratedMessageorGeneratedMessageLite.(package private) static booleansafeEquals(java.lang.Object a, java.lang.Object b)Returns true if both are null or both areObject.equals(java.lang.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>
UBstoreUnknownEnum(java.lang.Object containerMessage, int number, int enumValue, UB unknownFields, UnknownFieldSchema<UT,UB> unknownFieldSchema)Stores an unrecognized enum value as an unknown value.(package private) static java.lang.StringtoCamelCase(java.lang.String name, boolean capNext)static UnknownFieldSchema<?,?>unknownFieldSetFullSchema()static UnknownFieldSchema<?,?>unknownFieldSetLiteSchema()static voidwriteBool(int fieldNumber, boolean value, Writer writer)static voidwriteBoolList(int fieldNumber, java.util.List<java.lang.Boolean> value, Writer writer, boolean packed)static voidwriteBytes(int fieldNumber, ByteString value, Writer writer)static voidwriteBytesList(int fieldNumber, java.util.List<ByteString> value, Writer writer)static voidwriteDouble(int fieldNumber, double value, Writer writer)static voidwriteDoubleList(int fieldNumber, java.util.List<java.lang.Double> value, Writer writer, boolean packed)static voidwriteEnum(int fieldNumber, int value, Writer writer)static voidwriteEnumList(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed)static voidwriteFixed32(int fieldNumber, int value, Writer writer)static voidwriteFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed)static voidwriteFixed64(int fieldNumber, long value, Writer writer)static voidwriteFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed)static voidwriteFloat(int fieldNumber, float value, Writer writer)static voidwriteFloatList(int fieldNumber, java.util.List<java.lang.Float> value, Writer writer, boolean packed)static voidwriteGroupList(int fieldNumber, java.util.List<?> value, Writer writer)static voidwriteGroupList(int fieldNumber, java.util.List<?> value, Writer writer, Schema<?> schema)static voidwriteInt32(int fieldNumber, int value, Writer writer)static voidwriteInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed)static voidwriteInt64(int fieldNumber, long value, Writer writer)static voidwriteInt64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed)static voidwriteLazyFieldList(int fieldNumber, java.util.List<?> value, Writer writer)static voidwriteMessage(int fieldNumber, java.lang.Object value, Writer writer)static voidwriteMessageList(int fieldNumber, java.util.List<?> value, Writer writer)static voidwriteMessageList(int fieldNumber, java.util.List<?> value, Writer writer, Schema<?> schema)static voidwriteSFixed32(int fieldNumber, int value, Writer writer)static voidwriteSFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed)static voidwriteSFixed64(int fieldNumber, long value, Writer writer)static voidwriteSFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed)static voidwriteSInt32(int fieldNumber, int value, Writer writer)static voidwriteSInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed)static voidwriteSInt64(int fieldNumber, long value, Writer writer)static voidwriteSInt64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed)static voidwriteString(int fieldNumber, java.lang.Object value, Writer writer)private static voidwriteStringInternal(int fieldNumber, java.lang.String value, Writer writer)static voidwriteStringList(int fieldNumber, java.util.List<java.lang.String> value, Writer writer)static voidwriteUInt32(int fieldNumber, int value, Writer writer)static voidwriteUInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed)static voidwriteUInt64(int fieldNumber, long value, Writer writer)static voidwriteUInt64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed)
-
-
-
Field Detail
-
GENERATED_MESSAGE_CLASS
private static final java.lang.Class<?> GENERATED_MESSAGE_CLASS
-
UNKNOWN_FIELD_SET_FULL_SCHEMA
private static final UnknownFieldSchema<?,?> UNKNOWN_FIELD_SET_FULL_SCHEMA
-
UNKNOWN_FIELD_SET_LITE_SCHEMA
private static final UnknownFieldSchema<?,?> UNKNOWN_FIELD_SET_LITE_SCHEMA
-
DEFAULT_LOOK_UP_START_NUMBER
private static final int DEFAULT_LOOK_UP_START_NUMBER
- See Also:
- Constant Field Values
-
-
Method Detail
-
requireGeneratedMessage
public static void requireGeneratedMessage(java.lang.Class<?> messageType)
Requires that the given message extendGeneratedMessageorGeneratedMessageLite.
-
writeDouble
public static void writeDouble(int fieldNumber, double value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeFloat
public static void writeFloat(int fieldNumber, float value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeInt64
public static void writeInt64(int fieldNumber, long value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeUInt64
public static void writeUInt64(int fieldNumber, long value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeSInt64
public static void writeSInt64(int fieldNumber, long value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeFixed64
public static void writeFixed64(int fieldNumber, long value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeSFixed64
public static void writeSFixed64(int fieldNumber, long value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeInt32
public static void writeInt32(int fieldNumber, int value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeUInt32
public static void writeUInt32(int fieldNumber, int value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeSInt32
public static void writeSInt32(int fieldNumber, int value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeFixed32
public static void writeFixed32(int fieldNumber, int value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeSFixed32
public static void writeSFixed32(int fieldNumber, int value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeEnum
public static void writeEnum(int fieldNumber, int value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeBool
public static void writeBool(int fieldNumber, boolean value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeString
public static void writeString(int fieldNumber, java.lang.Object value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeStringInternal
private static void writeStringInternal(int fieldNumber, java.lang.String value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeBytes
public static void writeBytes(int fieldNumber, ByteString value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeMessage
public static void writeMessage(int fieldNumber, java.lang.Object value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeDoubleList
public static void writeDoubleList(int fieldNumber, java.util.List<java.lang.Double> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFloatList
public static void writeFloatList(int fieldNumber, java.util.List<java.lang.Float> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeInt64List
public static void writeInt64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeUInt64List
public static void writeUInt64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeSInt64List
public static void writeSInt64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFixed64List
public static void writeFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeSFixed64List
public static void writeSFixed64List(int fieldNumber, java.util.List<java.lang.Long> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeInt32List
public static void writeInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeUInt32List
public static void writeUInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeSInt32List
public static void writeSInt32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeFixed32List
public static void writeFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeSFixed32List
public static void writeSFixed32List(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeEnumList
public static void writeEnumList(int fieldNumber, java.util.List<java.lang.Integer> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeBoolList
public static void writeBoolList(int fieldNumber, java.util.List<java.lang.Boolean> value, Writer writer, boolean packed) throws java.io.IOException- Throws:
java.io.IOException
-
writeStringList
public static void writeStringList(int fieldNumber, java.util.List<java.lang.String> value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeBytesList
public static void writeBytesList(int fieldNumber, java.util.List<ByteString> value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeMessageList
public static void writeMessageList(int fieldNumber, java.util.List<?> value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeMessageList
public static void writeMessageList(int fieldNumber, java.util.List<?> value, Writer writer, Schema<?> schema) throws java.io.IOException- Throws:
java.io.IOException
-
writeLazyFieldList
public static void writeLazyFieldList(int fieldNumber, java.util.List<?> value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeGroupList
public static void writeGroupList(int fieldNumber, java.util.List<?> value, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
writeGroupList
public static void writeGroupList(int fieldNumber, java.util.List<?> value, Writer writer, Schema<?> schema) throws java.io.IOException- Throws:
java.io.IOException
-
computeSizeInt64ListNoTag
static int computeSizeInt64ListNoTag(java.util.List<java.lang.Long> list)
-
computeSizeInt64List
static int computeSizeInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)
-
computeSizeUInt64ListNoTag
static int computeSizeUInt64ListNoTag(java.util.List<java.lang.Long> list)
-
computeSizeUInt64List
static int computeSizeUInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)
-
computeSizeSInt64ListNoTag
static int computeSizeSInt64ListNoTag(java.util.List<java.lang.Long> list)
-
computeSizeSInt64List
static int computeSizeSInt64List(int fieldNumber, java.util.List<java.lang.Long> list, boolean packed)
-
computeSizeEnumListNoTag
static int computeSizeEnumListNoTag(java.util.List<java.lang.Integer> list)
-
computeSizeEnumList
static int computeSizeEnumList(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)
-
computeSizeInt32ListNoTag
static int computeSizeInt32ListNoTag(java.util.List<java.lang.Integer> list)
-
computeSizeInt32List
static int computeSizeInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)
-
computeSizeUInt32ListNoTag
static int computeSizeUInt32ListNoTag(java.util.List<java.lang.Integer> list)
-
computeSizeUInt32List
static int computeSizeUInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)
-
computeSizeSInt32ListNoTag
static int computeSizeSInt32ListNoTag(java.util.List<java.lang.Integer> list)
-
computeSizeSInt32List
static int computeSizeSInt32List(int fieldNumber, java.util.List<java.lang.Integer> list, boolean packed)
-
computeSizeFixed32ListNoTag
static int computeSizeFixed32ListNoTag(java.util.List<?> list)
-
computeSizeFixed32List
static int computeSizeFixed32List(int fieldNumber, java.util.List<?> list, boolean packed)
-
computeSizeFixed64ListNoTag
static int computeSizeFixed64ListNoTag(java.util.List<?> list)
-
computeSizeFixed64List
static int computeSizeFixed64List(int fieldNumber, java.util.List<?> list, boolean packed)
-
computeSizeBoolListNoTag
static int computeSizeBoolListNoTag(java.util.List<?> list)
-
computeSizeBoolList
static int computeSizeBoolList(int fieldNumber, java.util.List<?> list, boolean packed)
-
computeSizeStringList
static int computeSizeStringList(int fieldNumber, java.util.List<?> list)
-
computeSizeMessage
static int computeSizeMessage(int fieldNumber, java.lang.Object value, Schema<?> schema)
-
computeSizeMessageList
static int computeSizeMessageList(int fieldNumber, java.util.List<?> list)
-
computeSizeMessageList
static int computeSizeMessageList(int fieldNumber, java.util.List<?> list, Schema<?> schema)
-
computeSizeByteStringList
static int computeSizeByteStringList(int fieldNumber, java.util.List<ByteString> list)
-
computeSizeGroupList
static int computeSizeGroupList(int fieldNumber, java.util.List<MessageLite> list)
-
computeSizeGroupList
static int computeSizeGroupList(int fieldNumber, java.util.List<MessageLite> list, Schema<?> schema)
-
shouldUseTableSwitch
public static boolean shouldUseTableSwitch(FieldInfo[] fields)
Determines whether to issue tableswitch or lookupswitch for the mergeFrom method.- See Also:
shouldUseTableSwitch(int, int, int)
-
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.
-
unknownFieldSetFullSchema
public static UnknownFieldSchema<?,?> unknownFieldSetFullSchema()
-
unknownFieldSetLiteSchema
public static UnknownFieldSchema<?,?> unknownFieldSetLiteSchema()
-
getUnknownFieldSetSchema
private static UnknownFieldSchema<?,?> getUnknownFieldSetSchema()
-
getGeneratedMessageClass
private static java.lang.Class<?> getGeneratedMessageClass()
-
getUnknownFieldSetSchemaClass
private static java.lang.Class<?> getUnknownFieldSetSchemaClass()
-
getMapDefaultEntry
static java.lang.Object getMapDefaultEntry(java.lang.Class<?> clazz, java.lang.String name)
-
toCamelCase
static java.lang.String toCamelCase(java.lang.String name, boolean capNext)
-
safeEquals
static boolean safeEquals(java.lang.Object a, java.lang.Object b)Returns true if both are null or both areObject.equals(java.lang.Object).
-
mergeMap
static <T> void mergeMap(MapFieldSchema mapFieldSchema, T message, T o, long offset)
-
mergeExtensions
static <T,FT extends FieldSet.FieldDescriptorLite<FT>> void mergeExtensions(ExtensionSchema<FT> schema, T message, T other)
-
mergeUnknownFields
static <T,UT,UB> void mergeUnknownFields(UnknownFieldSchema<UT,UB> schema, T message, T other)
-
filterUnknownEnumList
@CanIgnoreReturnValue static <UT,UB> UB filterUnknownEnumList(java.lang.Object containerMessage, int number, java.util.List<java.lang.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(java.lang.Object containerMessage, int number, java.util.List<java.lang.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(java.lang.Object containerMessage, int number, int enumValue, UB unknownFields, UnknownFieldSchema<UT,UB> unknownFieldSchema)
Stores an unrecognized enum value as an unknown value.
-
-