public class Common extends Object
| Constructor and Description |
|---|
Common() |
| Modifier and Type | Method and Description |
|---|---|
static Map<String,Object> |
anyifyMapValue(Map<String,?> map)
Anyify the value of map
|
static List<Object> |
assertAsArray(Object object)
Assert a value, if it is a array, return it, otherwise throws
|
static Boolean |
assertAsBoolean(Object object)
Assert a value, if it is a boolean, return it, otherwise throws
|
static byte[] |
assertAsBytes(Object object)
Assert a value, if it is a bytes, return it, otherwise throws
|
static Integer |
assertAsInteger(Object value)
Assert a value, if it is a integer, return it, otherwise throws
|
static Map<String,Object> |
assertAsMap(Object object)
Assert a value, if it is a map, it, otherwise throws
|
static Number |
assertAsNumber(Object object)
Assert a value, if it is a number, return it, otherwise throws
|
static InputStream |
assertAsReadable(Object value)
Assert a value, if it is a readable, return it, otherwise throws
|
static String |
assertAsString(Object object)
Assert a value, if it is a string, return it, otherwise throws
|
static Number |
defaultNumber(Number number,
Number defaultNumber)
If not set the real, use default value
|
static String |
defaultString(String str,
String defaultStr)
If not set the real, use default value
|
static boolean |
empty(String str)
Check the string is empty?
|
static boolean |
equalNumber(Number num,
Number val)
Check one number equals another one?
|
static boolean |
equalString(String str,
String val)
Check one string equals another one?
|
static String |
getDateUTCString()
Get an UTC format string by current date, e.g.
|
static String |
getNonce()
Generate a nonce string
|
static String |
getUserAgent(String val)
Get user agent, if it userAgent is not null, splice it with defaultUserAgent and return, otherwise return defaultUserAgent
|
static boolean |
is2xx(Number code)
If the code between 200 and 300, return true, or return false
|
static boolean |
is3xx(Number code)
If the code between 300 and 400, return true, or return false
|
static boolean |
is4xx(Number code)
If the code between 400 and 500, return true, or return false
|
static boolean |
is5xx(Number code)
If the code between 500 and 600, return true, or return false
|
static boolean |
isUnset(Object object)
Check one value is unset
|
static Object |
parseJSON(String json)
Parse it by JSON format
|
static byte[] |
readAsBytes(InputStream stream)
Read data from a readable stream, and compose it to a bytes
|
static Object |
readAsJSON(InputStream stream)
Read data from a readable stream, and parse it by JSON format
|
static String |
readAsString(InputStream stream)
Read data from a readable stream, and compose it to a string
|
static void |
sleep(int millisecond)
Suspends the current thread for the specified number of milliseconds.
|
static Map<String,String> |
stringifyMapValue(Map<String,?> map)
Stringify the value of map
|
static List<Map<String,Object>> |
toArray(Object input)
Transform input as array.
|
static byte[] |
toBytes(String str)
Convert a string(utf8) to bytes
|
static String |
toFormString(Map<String,?> map)
Format a map to form string, like a=a%20b%20c
|
static String |
toJSONString(Object object)
If not set the real, use default value
|
static Map<String,Object> |
toMap(com.aliyun.tea.TeaModel in)
Model transforms to map[string]any
|
static String |
toString(byte[] bytes)
Convert a bytes to string(utf8)
|
static void |
validateModel(com.aliyun.tea.TeaModel m)
Validate model
|
public static byte[] toBytes(String str)
public static String toString(byte[] bytes)
public static Object parseJSON(String json)
public static Map<String,Object> assertAsMap(Object object)
public static List<Object> assertAsArray(Object object)
public static InputStream assertAsReadable(Object value)
public static byte[] assertAsBytes(Object object)
public static Number assertAsNumber(Object object)
public static Integer assertAsInteger(Object value)
public static String assertAsString(Object object)
public static Boolean assertAsBoolean(Object object)
public static byte[] readAsBytes(InputStream stream)
stream - the readable streampublic static String readAsString(InputStream stream)
stream - the readable streampublic static Object readAsJSON(InputStream stream)
stream - the readable streampublic static String getNonce()
public static String getDateUTCString()
public static String defaultString(String str, String defaultStr)
public static Number defaultNumber(Number number, Number defaultNumber)
public static String toFormString(Map<String,?> map)
public static String toJSONString(Object object)
public static boolean empty(String str)
public static boolean equalString(String str, String val)
public static boolean equalNumber(Number num, Number val)
public static boolean isUnset(Object object)
public static Map<String,String> stringifyMapValue(Map<String,?> map)
public static Map<String,Object> anyifyMapValue(Map<String,?> map)
public static String getUserAgent(String val)
public static boolean is2xx(Number code)
public static boolean is3xx(Number code)
public static boolean is4xx(Number code)
public static boolean is5xx(Number code)
public static void validateModel(com.aliyun.tea.TeaModel m)
public static Map<String,Object> toMap(com.aliyun.tea.TeaModel in)
public static void sleep(int millisecond)
Copyright © 2024. All rights reserved.