接口 | 说明 |
---|---|
ExceptionUtils.LineChecker | |
ExceptionUtils.SecureRun<T> |
Run in try-catch Throwable, change Throwable to NestedCheckedException
{捕获所有异常和错误}
|
FactoryBean<T> |
Bean工厂类,存放bean的实例和基本信息
|
FileUtils.TextFileParse<T> |
将文本文件内容解析、封装成相应的对象。
|
I18nExceptionSupport | |
JvmUtils.ShutdownHook | |
NamedRunnable |
可定义名字的Runnable
|
NestedException |
Nested Exception {嵌套的异常}
|
ReflectionMethodUtils.MethodCallback |
Action to take on each method.
|
ReflectionMethodUtils.MethodFilter |
Callback optionally used to filter methods to be operated on by a method callback.
|
ReflectionUtils.FieldCallback |
Callback interface invoked on each field in the hierarchy.
|
ReflectionUtils.FieldFilter |
Callback optionally used to filter fields to be operated on by a field callback.
|
类 | 说明 |
---|---|
AlgorithmUtils |
A Powerful Algorithmic Toolkit.
|
ArrayUtils |
注意:通常建议 首选将数组转换成集合Connection来操作,不建议 直接操作数组
|
Assert |
Assertion utility class that assists in validating arguments.
|
BeansSet |
OPGA设计模式(One Parameter Go Anywhere)中的参数Bean容器
用法和Map类似,任何类型的对象都可以add进来,然后通过get(id)方法获取 注意:BeansSet设计为线程私有的变量,故不支持线程同步。 |
ClassUtils |
Miscellaneous class utility methods.
|
CollectionUtils |
集合工具类
|
Const |
常用字符串常量
|
DateFormatUtils |
日期格式化工具类(高效的、线程安全的)
1、可以直接用静态方法format,原生底层算法实现,参见 DateFormatUtils.format()
2、可以自己new一个,例如new DateFormatUtils(yyyy_MM_dd)并保存为static常量, new的时候可指定格式,后面就可以随时调用format和parse方法,线程安全. |
DateFormatUtils.DateInfo |
存放最原始、最详细的时间信息,可根据需要进行自由组合 例如 组合成 yyyyMMdd 格式: getYyyy()+getMM()+getDd()
|
EqualsBuilder |
Lookup:
if ( null == lhs == rhs ) return true
|
ExceptionUtils |
设计目的:
1、有些错误信息(errorMsg)非常的长,比如Spring或Hibernate或JDBC的错误信息; 2、一些异常的堆栈特别大,动辄几十、上百行,例如Tomcat、WebSphere的异常信息。 |
FileUtils |
file utils best practice
{高效的常用文件工具类}
|
FileUtils.FileModifiedTimeComparator |
按文件修改日期降序排列【最新的排在最上面】
|
IOUtils |
IO utils best practice
{高效的IO工具类}
|
JvmUtils |
JVM 工具类
|
LocaleUtils |
java.util.Locale增强工具,String转Locale对象
|
NamedThreadFactory |
可定义名字的ThreadFactory
|
ObjectBean<T> |
存放bean的实例和基本信息
|
ObjectUtils | |
RandomUtils |
线程安全的随机数生成工具
|
ReflectionMethodUtils | |
ReflectionUtils |
Simple utility class for working with
the reflection API and handling reflection exceptions.
|
ResourceUtils |
资源文件工具类
|
StringSplitUtils |
高效的字符串split工具,非正则表达式,与java.lang.String#split的实现截然不同
Split 终极用法
一、整个字符串作为分隔符:(保留分割出来的空白字符)
---使用 splitByWholeSeparator (等价于org.springframework.util.StringUtils.delimitedListToStringArray[])
二、单个字符、或者字符串的所有字符都 作为分隔符:(保留分割出来的空白字符)
---使用 split
再考虑一下特殊情况:
三、不保留 分割出来的空白字符:
---使用
splitIgnoreEmpty (等价于java.util.StringTokenizer,性能上差不多)
splitByWholeIgnoreEmpty
四、保留非末尾的所有空白字符:
---使用
splitNolastEmpty
splitByWholeNolastEmpty (等价于java.lang.String.split[])
五、可以将取出来的值,每一个都进行trim
---使用 split???
|
StringUtils |
通用字符串工具类
|
ThreadUtils |
常用的 Thread 工具类
|
UrlUtils |
URL 工具类,主要取自Spring Framework
|
异常错误 | 说明 |
---|---|
BasicCheckedException |
最基础的Checked异常类,所有其他的Checked异常都继承于本类
|
BasicRuntimeException |
最基础的Runtime异常类,所有其他的Runtime异常都继承于本类
|
NestedCheckedException |
NestedCheckedException
用于包装异常信息
|
NestedIOException |
NestedIOException的作用:
如下例:
public URI getURI() throws IOException {
URL url = getURL();
try {
return UrlUtils.toURI(url);
}
catch (URISyntaxException ex) {
throw new NestedIOException(ex);
}
}
如果外层只捕获 IOException,则内部抛出的其他异常无法捕获,所以必须要将内部其它异常 转换成IOException。
|
NestedRuntimeException |
NestedRuntimeException
用于包装异常信息
|
Copyright © 2018 jretty-org. All rights reserved.