public class Helpers extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static org.slf4j.Logger |
LOG |
static int |
MAX_RADIX
最大进制数
|
static int |
MIN_RADIX
最小进制数
|
static int |
SEED_DIGIT |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> int |
add(Collection<T> container,
Collection<T> values) |
static <T> int |
add(Collection<T> container,
Enumeration<T> values) |
static <T> int |
add(Collection<T> container,
Iterator<T> values) |
static <T> int |
add(Collection<T> container,
T... values) |
static <T> boolean |
add(Collection<T> container,
T value) |
static <T> T |
coalesce(T... instances) |
static Object |
compact(Object value)
数组紧凑化
|
static int |
compare(Object other,
Object another) |
static boolean |
contains(List<?> a,
List<?> b) |
static <T> Object |
each(boolean multipled,
Object array,
Callable<T> callable,
Object... args)
遍历操作
|
static <T> Object |
each(Object instance,
Callable<T> callable,
Object... args)
遍历操作
|
static boolean |
equals(Object source,
Object target) |
static Object |
fromJson(String json) |
static <T> T |
fromJson(String json,
Class<T> clazz) |
static InetAddress |
getAddress()
获取地址
|
static SocketAddress |
getAddress(int port)
获取地址
|
static InetAddress |
getAddress(String host) |
static SocketAddress |
getAddress(String host,
int port)
获取地址
|
static String |
getAliasName(Annotation[] annos) |
static String |
getAliasName(Class<?> clazz) |
static String |
getAliasName(Class<?> clazz,
String mask) |
static String |
getAliasName(Class<?> clazz,
String mask,
String value) |
static String |
getAliasName(Method method) |
static String |
getAliasName(Method method,
String mask) |
static String |
getAliasName(Method method,
String mask,
String value) |
static int |
getBitCount(byte[] bytes) |
static int |
getBitCount(long value) |
static String |
getCPUID()
获取CPU标识
|
static <T> T |
getElement(Object array,
Class<T> rawClass) |
static Object |
getElement(Object array,
int index) |
static String |
getHDID()
获取硬盘标识
|
static int |
getIndex(Object array,
Object instance) |
static Object |
getInstance(Map<String,? extends Object> params,
String key) |
static int |
getLength(Object array) |
static Map<String,? extends Object> |
getMap(Map<String,? extends Object> params,
String key) |
static <T> List<T> |
getMerge(List<T> source,
List<T> target)
获取合并结果
|
static Properties |
getProperties(boolean isXML,
Object source,
String name) |
static Properties |
getProperties(boolean isXML,
String name) |
static Properties |
getProperties(boolean isXML,
URL url) |
static Properties |
getProperties(File file) |
static Properties |
getProperties(Object source,
String name) |
static Properties |
getProperties(String name) |
static URL |
getPropertiesURL(boolean isXML,
Object source,
String name) |
static URL |
getPropertiesURL(boolean isXML,
String name) |
static String |
getProperty(Class<?> clazz,
String id,
Object... args) |
static String |
getProperty(Class<?> clazz,
String dialect,
String id,
Object... args) |
static String |
getProperty(String key) |
static String |
getProperty(String suffix,
Class<?> clazz,
String dialect,
String id,
Object... args) |
static String |
getProperty(String key,
String value) |
static int |
getRandom()
获取随机数
|
static int |
getRandom(int limit)
获取随机数
|
static String |
getRuntimeProcess()
当前运行进程
|
static String |
getStackTrace(Throwable cause) |
static <T> List<T> |
getSurplus(List<T> source,
List<T> target)
获取目标盈余
|
static URL |
getURL(File file) |
static Object |
getValue(Map<String,? extends Object> params,
String key) |
static Object |
getValue(Map<String,? extends Object> params,
String key,
Class<?> rawClass) |
static Object |
getValue(Map<String,? extends Object> params,
String key,
String suffix) |
static Object |
getValues(Map<String,? extends Object> params,
String key) |
static Object |
getValues(Map<String,? extends Object> params,
String key,
String suffix) |
static Object |
getValues(Map<String,Object> params,
String key,
Class<?> rawClass) |
static <T> T[] |
group(T... args) |
static <T> T[][] |
groups(T[]... args) |
static boolean |
hasAliasName(AnnotatedElement element) |
static boolean |
hasAliasName(Annotation[] annos) |
static int |
hashCode(Object instance) |
static boolean |
isCode(String value) |
static boolean |
isCode(String value,
int limit) |
static boolean |
isEmail(String email) |
static boolean |
isEmpty(Collection<?> values) |
static boolean |
isEmpty(Map<?,?> values) |
static boolean |
isMultiple(Object instance) |
static boolean |
isUrl(String url) |
static Properties |
load(Properties props,
boolean isXML,
Object source,
String name) |
static Properties |
load(Properties props,
boolean isXML,
String name) |
static Properties |
load(Properties props,
boolean isXML,
URL url) |
static Properties |
load(Properties props,
File file) |
static Properties |
load(Properties props,
Object source,
String name) |
static Properties |
load(Properties props,
String name) |
static String |
makeCode(int length)
生成指定位数编码
|
static String |
makeCode(int length,
int seed)
生成指定位数编码
|
static String |
makeMarchineCode()
生成机器码
|
static String |
makeMD5(byte[] value)
生成MD5摘要
|
static String |
makeMD5(String value)
生成MD5摘要
|
static String |
makeUUID()
生成20位UUID
|
static <T> T[] |
newArray(Class<T> resultType,
Object[] source,
int count) |
static Object |
newArray(Object source) |
static Object |
newArray(Object source,
int length) |
static Object |
newArray(Object source,
Object target) |
static Object[][] |
newGrid(boolean isColumn,
Object... values) |
static <T> List<T> |
newList(Enumeration<T> values) |
static <T> List<T> |
newList(Iterator<T> values) |
static <K,V> Map<K,V> |
newMap(Map<K,V> source,
K... keys) |
static <T> T |
nvl(T value,
T alternative) |
static <T> T |
nvl(T value,
T leftist,
T rightist) |
static String |
parse(long value,
int radix)
将长整型数值转换为指定的进制数
|
static long |
parse(String value,
int radix)
将字符串转换为指定的进制数长整型数值
|
static void |
readying(Callable<Boolean> readyable) |
static void |
readying(Callable<Boolean> readyable,
long ms) |
static Object |
resolve(boolean resolved,
Object leftist,
Object rightist) |
static <T> T |
resolve(boolean resolved,
T value) |
static String |
run(String cmd,
int line) |
static String |
run(String cmd,
String regex) |
static void |
sleep(int s) |
static void |
sleep(long ms) |
static void |
sleep(long ms,
int ns) |
static <T> List<T> |
sort(List<T> instances) |
static <K,V> List<Map.Entry<K,V>> |
sortByKey(Map<K,V> instances) |
static <K,V> List<Map.Entry<K,V>> |
sortByKey(Set<Map.Entry<K,V>> instances) |
static <K,V> List<Map.Entry<K,V>> |
sortByValue(Map<K,V> instances) |
static <K,V> List<Map.Entry<K,V>> |
sortByValue(Set<Map.Entry<K,V>> instances) |
static <K,T> boolean |
toAppend(Map<K,List<T>> values,
K name,
T value)
追加实例
|
static <K,T> boolean |
toAppend(Map<K,List<T>> values,
K name,
T value,
boolean repeat)
追加实例
|
static <K,T> int |
toAppends(Map<K,List<T>> values,
K name,
Collection<T> value)
追加实例
|
static <K,T> int |
toAppends(Map<K,List<T>> values,
K name,
Collection<T> value,
boolean repeat)
追加实例
|
static Object |
toArray(Class<?> type,
Object source) |
static Object |
toArray(Object source) |
static boolean |
toBoolean(Object value)
转换布尔值
|
static double |
toDouble(Object value)
转换双精度
|
static double |
toDouble(Object value,
double def)
转换双精度
|
static Map<String,Object> |
toFlat(Map<String,Object> values)
集合扁平化
|
static String |
toHex(byte[] values)
转换16进制
|
static byte[] |
toHex(String hex)
转换16进制
|
static Map<String,? extends Object> |
toHierarchical(Map<String,? extends Object> values)
集合层级化
|
static int |
toInt(int radix,
String value,
int beginIndex,
int endIndex) |
static int |
toInt(Object value)
转换整形
|
static int |
toInt(Object value,
int def)
转换整形
|
static int |
toInt(String value,
int beginIndex,
int endIndex) |
static String |
toJson(Object instance) |
static String |
toJson(Object instance,
boolean desensitization) |
static long |
toLong(Object value)
转换长整形
|
static long |
toLong(Object value,
long def)
转换长整形
|
static byte |
toRadix(char value) |
static <T> Map<String,List<T>> |
toUnmodifiable(Map<String,List<T>> values)
屏蔽集合修改功能
|
static <K,V> Map<K,V> |
trim(Map<K,V> values) |
static Object |
wrap(Object... args) |
static Object[] |
wraps(Object... args) |
public static final org.slf4j.Logger LOG
public static final int SEED_DIGIT
public static final int MAX_RADIX
public static final int MIN_RADIX
public static String parse(long value, int radix)
value - radix - public static long parse(String value, int radix)
value - radix - public static boolean toBoolean(Object value)
value - public static int toInt(Object value)
value - public static int toInt(Object value, int def)
value - def - public static long toLong(Object value)
value - public static long toLong(Object value, long def)
value - def - public static double toDouble(Object value)
value - public static double toDouble(Object value, double def)
value - def - public static String toHex(byte[] values)
values - public static byte[] toHex(String hex)
hex - public static byte toRadix(char value)
public static String makeMD5(byte[] value)
value - public static String makeUUID()
public static String makeMarchineCode()
public static String makeCode(int length)
length - public static String makeCode(int length, int seed)
length - seed - public static int getRandom()
public static int getRandom(int limit)
limit - public static int getBitCount(long value)
public static int getBitCount(byte[] bytes)
public static Properties getProperties(File file)
public static Properties getProperties(String name)
public static Properties getProperties(Object source, String name)
public static Properties getProperties(boolean isXML, String name)
public static Properties getProperties(boolean isXML, Object source, String name)
public static Properties getProperties(boolean isXML, URL url)
public static Properties load(Properties props, File file)
public static Properties load(Properties props, String name)
public static Properties load(Properties props, Object source, String name)
public static Properties load(Properties props, boolean isXML, String name)
public static Properties load(Properties props, boolean isXML, Object source, String name)
public static Properties load(Properties props, boolean isXML, URL url)
public static String getProperty(Class<?> clazz, String dialect, String id, Object... args)
public static String getProperty(String suffix, Class<?> clazz, String dialect, String id, Object... args)
public static boolean hasAliasName(AnnotatedElement element)
public static boolean hasAliasName(Annotation[] annos)
public static String getAliasName(Annotation[] annos)
public static boolean isEmpty(Map<?,?> values)
public static boolean isEmpty(Collection<?> values)
public static boolean isMultiple(Object instance)
public static <T> Map<String,List<T>> toUnmodifiable(Map<String,List<T>> values)
values - public static Map<String,? extends Object> toHierarchical(Map<String,? extends Object> values)
values - public static <K,T> boolean toAppend(Map<K,List<T>> values, K name, T value)
values - name - value - public static <K,T> boolean toAppend(Map<K,List<T>> values, K name, T value, boolean repeat)
values - name - value - repeat - public static <K,T> int toAppends(Map<K,List<T>> values, K name, Collection<T> value)
values - name - value - public static <K,T> int toAppends(Map<K,List<T>> values, K name, Collection<T> value, boolean repeat)
values - name - value - public static <T> List<T> getSurplus(List<T> source, List<T> target)
source - target - public static <T> List<T> getMerge(List<T> source, List<T> target)
source - target - public static <T> int add(Collection<T> container, Enumeration<T> values)
public static <T> int add(Collection<T> container, Iterator<T> values)
public static <T> int add(Collection<T> container, T... values)
public static <T> int add(Collection<T> container, Collection<T> values)
public static <T> boolean add(Collection<T> container, T value)
public static <T> List<T> newList(Enumeration<T> values)
public static Map<String,? extends Object> getMap(Map<String,? extends Object> params, String key)
@SafeVarargs public static <T> T[] group(T... args)
public static <T> T[][] groups(T[]... args)
public static void sleep(int s)
public static void sleep(long ms)
public static void sleep(long ms,
int ns)
public static InetAddress getAddress()
Exceptionpublic static InetAddress getAddress(String host)
public static SocketAddress getAddress(int port)
port - public static SocketAddress getAddress(String host, int port)
host - port - public static boolean isCode(String value)
public static boolean isCode(String value, int limit)
public static <T> Object each(Object instance, Callable<T> callable, Object... args)
instance - callable - args - public static <T> Object each(boolean multipled, Object array, Callable<T> callable, Object... args)
multipled - array - callable - args - public static int getLength(Object array)
public static Object getValue(Map<String,? extends Object> params, String key, String suffix)
public static Object getValue(Map<String,? extends Object> params, String key, Class<?> rawClass)
public static Object getValues(Map<String,? extends Object> params, String key, String suffix)
public static <T> T nvl(T value,
T alternative)
public static <T> T nvl(T value,
T leftist,
T rightist)
public static <T> T resolve(boolean resolved,
T value)
public static <T> T coalesce(T... instances)
public static int toInt(String value, int beginIndex, int endIndex)
public static int toInt(int radix,
String value,
int beginIndex,
int endIndex)
public static int hashCode(Object instance)
public static boolean isUrl(String url)
public static boolean isEmail(String email)
public static String getRuntimeProcess()
public static String getCPUID()
public static String getHDID()
Copyright © 2024. All rights reserved.