public class CodedConstant extends Object
| 构造器和说明 |
|---|
CodedConstant() |
| 限定符和类型 | 方法和说明 |
|---|---|
static List |
asList(String value)
As list.
|
static String |
capitalize(String str)
Capitalizes a String changing the first letter to title case as per
Character.toTitleCase(char). |
static int |
computeListSize(int order,
List list,
FieldType type,
boolean debug,
File path)
Compute list size.
|
static int |
computeSize(int order,
Object o,
FieldType type,
boolean list,
boolean debug,
File path)
get object size by
FieldType. |
static int |
computeSize(int order,
Object o,
FieldType type,
boolean debug,
File path)
get object size by
FieldType. |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor(Class<?> cls)
Gets the descriptor.
|
static String |
getEnumName(Enum[] e,
int value)
Gets the enum name.
|
static <T extends Enum<T>> |
getEnumValue(Class<T> enumType,
String name)
Gets the enumeration value.
|
static String |
getFieldName(int order)
get field name.
|
static String |
getFiledType(FieldType type,
boolean isList)
Gets the filed type.
|
static String |
getMappedTypeDefined(int order,
FieldType type,
String express,
boolean isList)
get mapped type defined java expression.
|
static String |
getMappedTypeSize(FieldInfo field,
int order,
FieldType type,
boolean isList,
boolean debug,
File path)
Gets the mapped type size.
|
static String |
getMappedWriteCode(FieldInfo field,
String prefix,
int order,
FieldType type,
boolean isList)
get mapped object byte write java expression.
|
static String |
getRequiredCheck(int order,
Field field)
get required field check java expression.
|
static String |
getRetRequiredCheck(String express,
Field field)
get return required field check java expression.
|
static String |
getWriteValueToField(FieldType type,
String express,
boolean isList)
Gets the write value to field.
|
static boolean |
isNull(byte o)
check byte is null.
|
static boolean |
isNull(char o)
check char is null.
|
static boolean |
isNull(Collection list)
Checks if is null.
|
static boolean |
isNull(double o)
check double is null.
|
static boolean |
isNull(float o)
check float is null.
|
static boolean |
isNull(int o)
check int is null.
|
static boolean |
isNull(long o)
check long is null.
|
static boolean |
isNull(Map map)
Checks if is null.
|
static boolean |
isNull(Object o)
check object is null.
|
static boolean |
isNull(short o)
check short is null.
|
static int |
makeTag(int fieldNumber,
int wireType)
make protobuf tag.
|
static void |
writeObject(com.google.protobuf.CodedOutputStream out,
int order,
FieldType type,
Object o,
boolean list)
Write object to byte array by
FieldType. |
static void |
writeToList(com.google.protobuf.CodedOutputStream out,
int order,
FieldType type,
List list)
write list to
CodedOutputStream object. |
public static String getFieldName(int order)
order - field orderpublic static String getMappedTypeDefined(int order, FieldType type, String express, boolean isList)
order - field ordertype - field typeexpress - java expressionisList - is field type is a Listpublic static String getFiledType(FieldType type, boolean isList)
type - the typeisList - the is listpublic static String getWriteValueToField(FieldType type, String express, boolean isList)
type - the typeexpress - the expressisList - the is listpublic static String getMappedTypeSize(FieldInfo field, int order, FieldType type, boolean isList, boolean debug, File path)
field - fieldorder - field ordertype - field typeisList - is field type is a Listdebug - debug mode if true enable debug.path - the pathpublic static int computeListSize(int order,
List list,
FieldType type,
boolean debug,
File path)
order - field orderlist - field valuetype - field type of list objdebug - the debugpath - the pathpublic static int computeSize(int order,
Object o,
FieldType type,
boolean debug,
File path)
FieldType.order - the ordero - the otype - the typedebug - the debugpath - the pathpublic static int computeSize(int order,
Object o,
FieldType type,
boolean list,
boolean debug,
File path)
FieldType.order - the ordero - the otype - the typelist - the listdebug - the debugpath - the pathpublic static String getMappedWriteCode(FieldInfo field, String prefix, int order, FieldType type, boolean isList)
field - the fieldprefix - the prefixorder - field ordertype - field typeisList - the is listpublic static void writeToList(com.google.protobuf.CodedOutputStream out,
int order,
FieldType type,
List list)
throws IOException
CodedOutputStream object.out - target output stream to writeorder - field ordertype - field typelist - target list object to be serializedIOException - Signals that an I/O exception has occurred.public static void writeObject(com.google.protobuf.CodedOutputStream out,
int order,
FieldType type,
Object o,
boolean list)
throws IOException
FieldType.out - the outorder - the ordertype - the typeo - the olist - the listIOException - Signals that an I/O exception has occurred.public static String getRequiredCheck(int order, Field field)
order - field orderfield - java fieldpublic static String getRetRequiredCheck(String express, Field field)
express - java expressionfield - java fieldpublic static boolean isNull(Object o)
o - to checkpublic static boolean isNull(Collection list)
list - the listpublic static boolean isNull(Map map)
map - the mappublic static boolean isNull(double o)
o - to checkpublic static boolean isNull(int o)
o - to checkpublic static boolean isNull(byte o)
o - to checkpublic static boolean isNull(short o)
o - to checkpublic static boolean isNull(long o)
o - to checkpublic static boolean isNull(float o)
o - to checkpublic static boolean isNull(char o)
o - to checkpublic static String capitalize(String str)
Capitalizes a String changing the first letter to title case as per Character.toTitleCase(char). No other
letters are changed.
str - the String to capitalize, may be nullnull if null String inputpublic static int makeTag(int fieldNumber,
int wireType)
fieldNumber - field number orderwireType - wireformat typepublic static String getEnumName(Enum[] e, int value)
e - the evalue - the valuepublic static <T extends Enum<T>> T getEnumValue(Class<T> enumType, String name)
T - the generic typeenumType - the enum typename - the namepublic static com.google.protobuf.Descriptors.Descriptor getDescriptor(Class<?> cls) throws IOException
cls - the clsIOException - Signals that an I/O exception has occurred.Copyright © 2019 Baidu, Inc.. All rights reserved.