public final class CommonUtil extends Object
| 构造器和说明 |
|---|
CommonUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
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 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 <T> Map<String,T> |
buildMap(TeaPair... pairs) |
static Object |
defaultAny(Object inputValue,
Object defaultValue)
If inputValue is not null, return it or return defaultValue
|
static String |
getDateUTCString()
Get an UTC format string by current date, e.g.
|
static String |
getEncodePath(String path) |
static String |
getNonce()
Generate a nonce string
|
static String |
getTimestamp()
Get timestamp
|
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 |
isNot2xx(Number code)
If the code after 300, return true, or return false
|
static boolean |
isUnset(Object object) |
static <T> Map<String,T> |
merge(Class<T> t,
Object... maps) |
static Object |
parseNumber(Object value,
Class clazz) |
public static boolean isUnset(Object object)
public static Object defaultAny(Object inputValue, Object defaultValue)
inputValue - users input valuedefaultValue - default valuepublic 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 String assertAsString(Object object)
public static Boolean assertAsBoolean(Object object)
public static String getNonce()
public static String getDateUTCString()
public static boolean isNot2xx(Number code)
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 String getEncodePath(String path) throws UnsupportedEncodingException
public static String getTimestamp()
Copyright © 2023. All rights reserved.