| Modifier and Type | Method and Description |
|---|---|
static boolean |
ObjectUtil.equals(Object a,
Object b)
JDK7 引入的Null安全的equals
|
static boolean |
ObjectUtil.equals(Object a,
Object b)
JDK7 引入的Null安全的equals
|
static boolean |
ExceptionUtil.isCausedBy(Throwable throwable,
Class<? extends Exception>... causeExceptionClasses)
判断异常是否由某些底层的异常引起.
|
static double |
MoreValidate.nonNegative(String role,
double x)
校验为非负数则返回该数字,否则抛出异常.
|
static int |
MoreValidate.nonNegative(String role,
int x)
校验为非负数则返回该数字,否则抛出异常.
|
static Integer |
MoreValidate.nonNegative(String role,
Integer x)
校验为非负数则返回该数字,否则抛出异常.
|
static long |
MoreValidate.nonNegative(String role,
long x)
校验为非负数则返回该数字,否则抛出异常.
|
static Long |
MoreValidate.nonNegative(String role,
Long x)
校验为非负数则返回该数字,否则抛出异常.
|
static double |
MoreValidate.positive(String role,
double x)
校验为正数则返回该数字,否则抛出异常.
|
static int |
MoreValidate.positive(String role,
int x)
校验为正数则返回该数字,否则抛出异常.
|
static Integer |
MoreValidate.positive(String role,
Integer x)
校验为正数则返回该数字,否则抛出异常.
|
static long |
MoreValidate.positive(String role,
long x)
校验为正数则返回该数字,否则抛出异常.
|
static Long |
MoreValidate.positive(String role,
Long x)
校验为正数则返回该数字,否则抛出异常.
|
static String |
ExceptionUtil.toStringWithRootCause(Throwable t)
拼装 短异常类名: 异常信息 <-- RootCause的短异常类名: 异常信息
|
static String |
ExceptionUtil.toStringWithShortName(Throwable t)
拼装 短异常类名: 异常信息.
|
static RuntimeException |
ExceptionUtil.unchecked(Throwable t)
将CheckedException转换为RuntimeException重新抛出, 可以减少函数签名中的CheckExcetpion定义.
|
static Throwable |
ExceptionUtil.unwrap(Throwable t)
如果是著名的包裹类,从cause中获得真正异常.
|
static RuntimeException |
ExceptionUtil.unwrapAndUnchecked(Throwable t)
组合unwrap与unchecked,用于处理反射/Callable的异常
|
| Modifier and Type | Method and Description |
|---|---|
L |
Pair.getLeft() |
L |
Triple.getLeft() |
M |
Triple.getMiddle() |
R |
Pair.getRight() |
R |
Triple.getRight() |
| Modifier and Type | Method and Description |
|---|---|
static <L,M,R> Triple<L,M,R> |
Triple.of(L left,
M middle,
R right)
根据等号左边的泛型,自动构造合适的Triple
|
static <L,M,R> Triple<L,M,R> |
Triple.of(L left,
M middle,
R right)
根据等号左边的泛型,自动构造合适的Triple
|
static <L,M,R> Triple<L,M,R> |
Triple.of(L left,
M middle,
R right)
根据等号左边的泛型,自动构造合适的Triple
|
static <L,R> Pair<L,R> |
Pair.of(L left,
R right)
根据等号左边的泛型,自动构造合适的Pair
|
static <L,R> Pair<L,R> |
Pair.of(L left,
R right)
根据等号左边的泛型,自动构造合适的Pair
|
| Constructor and Description |
|---|
Pair(L left,
R right)
Creates a new pair.
|
Pair(L left,
R right)
Creates a new pair.
|
Triple(L left,
M middle,
R right)
Creates a new Triple.
|
Triple(L left,
M middle,
R right)
Creates a new Triple.
|
Triple(L left,
M middle,
R right)
Creates a new Triple.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T[] |
ArrayUtil.concat(T[] array,
T element)
添加元素到数组末尾.
|
static <T> T[] |
ArrayUtil.concat(T element,
T[] array)
添加元素到数组头.
|
static <C,K extends C,V> |
MapUtil.newSortedMap(Comparator<C> comparator)
根据等号左边的类型,构造类型正确的TreeMap.
|
static <T> TreeSet<T> |
SetUtil.newSortedSet(Comparator<? super T> comparator)
根据等号左边的类型,构造类型正确的TreeSet, 并设置comparator.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
ThreadPoolUtil.gracefulShutdown(ExecutorService threadPool,
int shutdownTimeoutMills)
按照ExecutorService JavaDoc示例代码编写的Graceful Shutdown方法.
|
static boolean |
ThreadPoolUtil.gracefulShutdown(ExecutorService threadPool,
int shutdownTimeout,
TimeUnit timeUnit) |
| Modifier and Type | Method and Description |
|---|---|
static void |
FileUtil.deleteFile(File file)
删除文件.
|
static void |
FileUtil.deleteFile(Path path)
删除文件.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
JsonMapper.fromJson(String jsonString,
Class<T> clazz)
反序列化POJO或简单Collection如List
|
<T> T |
JsonMapper.fromJson(String jsonString,
com.fasterxml.jackson.databind.JavaType javaType)
反序列化复杂Collection如List
|
| Modifier and Type | Method and Description |
|---|---|
static Integer |
NumberUtil.hexToIntObject(String str,
Integer defaultValue)
将16进制的String转化为Integer,出错时返回默认值.
|
static Long |
NumberUtil.hexToLongObject(String str,
Long defaultValue)
将16进制的String转化为Long,出错时返回默认值.
|
static boolean |
NumberUtil.isHexNumber(String value)
判断字符串是否16进制
|
static boolean |
NumberUtil.isNumber(String str)
判断字符串是否合法数字
|
static double |
NumberUtil.toDouble(String str,
double defaultValue)
将10进制的String安全的转化为double.
|
static Double |
NumberUtil.toDoubleObject(String str,
Double defaultValue)
将10进制的String安全的转化为Long.
|
static int |
NumberUtil.toInt(String str,
int defaultValue)
将10进制的String安全的转化为int.
|
static Integer |
NumberUtil.toIntObject(String str,
Integer defaultValue)
将10进制的String安全的转化为Integer.
|
static long |
NumberUtil.toLong(String str,
long defaultValue)
将10进制的String安全的转化为long.
|
static Long |
NumberUtil.toLongObject(String str,
Long defaultValue)
将10进制的String安全的转化为Long.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
MoreStringUtil.endWith(CharSequence s,
char c)
判断字符串是否以字母结尾
如果字符串为Null或空,返回false
|
static boolean |
TextValidator.isDate(CharSequence input)
验证yyyy-MM-dd格式的日期校验,已考虑平闰年
|
static boolean |
TextValidator.isEmail(CharSequence input)
验证邮箱
|
static boolean |
TextValidator.isIdCard(CharSequence input)
验证15或18位身份证号码
|
static boolean |
TextValidator.isIp(CharSequence input)
验证IP地址
|
static boolean |
TextValidator.isMobileExact(CharSequence input)
验证手机号(精确)
|
static boolean |
TextValidator.isMobileSimple(CharSequence input)
验证手机号(简单)
|
static boolean |
TextValidator.isTel(CharSequence input)
验证固定电话号码
|
static boolean |
TextValidator.isUrl(CharSequence input)
验证URL
|
static String |
MoreStringUtil.replaceFirst(String s,
char sub,
char with)
String 有replace(char,char),但缺少单独replace first/last的
|
static String |
MoreStringUtil.replaceLast(String s,
char sub,
char with)
String 有replace(char,char)替换全部char,但缺少单独replace first/last
|
static byte[] |
HashUtil.sha1(byte[] input,
byte[] salt)
对输入字符串进行sha1散列,带salt达到更高的安全性.
|
static byte[] |
HashUtil.sha1(byte[] input,
byte[] salt,
int iterations)
对输入字符串进行sha1散列,带salt而且迭代达到更高更高的安全性.
|
static byte[] |
HashUtil.sha1(String input,
byte[] salt)
对输入字符串进行sha1散列,带salt达到更高的安全性.
|
static byte[] |
HashUtil.sha1(String input,
byte[] salt,
int iterations)
对输入字符串进行sha1散列,带salt而且迭代达到更高更高的安全性.
|
static List<String> |
MoreStringUtil.split(String str,
char separatorChar)
高性能的Split,针对char的分隔符号,比JDK String自带的高效.
|
static List<String> |
MoreStringUtil.split(String str,
char separatorChar,
int expectParts)
高性能的Split,针对char的分隔符号,比JDK String自带的高效.
|
static boolean |
MoreStringUtil.startWith(CharSequence s,
char c)
判断字符串是否以字母开头
如果字符串为Null或空,返回false
|
static int |
MoreStringUtil.utf8EncodedLength(CharSequence sequence)
计算字符串被UTF8编码后的字节数 via guava
|
Copyright © 2018. All rights reserved.