org.apache.commons等常用工具学习
StringUtils
1,StringUtils.isNotBlank
isNotEmpty :
判断某字符串是否非空
StringUtils.isNotEmpty(null) = false
StringUtils.isNotEmpty("") = false
StringUtils.isNotEmpty(" ") = true
StringUtils.isNotEmpty("bob") = true isNotBlank:
判断某字符串是否不为空且长度不为0且不由空白符(whitespace)构成,
下面是示例:
StringUtils.isNotBlank(null) = false
StringUtils.isNotBlank("") = false
StringUtils.isNotBlank(" ") = false
StringUtils.isNotBlank("\t \n \f \r") = false
beanUtils
beanUtils 对象转map,
https://www.cnblogs.com/jing1617/p/7007580.html
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency> 直接转,没有的字段是默认值,要自己处理,注意要先new出来,在apache-commons下需要时public


SerializationUtils.clone(obj)
Student student3 = SerializationUtils.clone(Student);
例外几种方法的深拷贝:1,set,2,json,3,dozer(没有看
ClassUtils
System.out.println(genHeader("ClassUtilsDemo"));
System.out.println("获取类实现的所有接口.");
System.out.println(ClassUtils.getAllInterfaces(Date.class));
System.out.println("获取类所有父类.");
System.out.println(ClassUtils.getAllSuperclasses(Date.class));
System.out.println("获取简单类名.");
System.out.println(ClassUtils.getShortClassName(Date.class));
System.out.println("获取包名.");
System.out.println(ClassUtils.getPackageName(Date.class));
System.out.println("判断是否可以转型.");
System.out.println(ClassUtils.isAssignable(Date.class, Object.class));
System.out.println(ClassUtils.isAssignable(Object.class, Date.class));
获取类实现的所有接口.
[interface java.io.Serializable, interface java.lang.Cloneable, interface java.lang.Comparable]
获取类所有父类.
[class java.lang.Object]
获取简单类名.
Date
获取包名.
java.util
判断是否可以转型.
true
false
WordUtils
private void wordUtilsDemo() {
System.out.println("单词处理功能");
String str1 = "wOrD";
String str2 = "ghj\nui\tpo";
System.out.println(WordUtils.capitalize(str1)); // 首字母大写
System.out.println(WordUtils.capitalizeFully(str1)); // 首字母大写其它字母小写
char[] ctrg = {'.'};
System.out.println(WordUtils.capitalizeFully("i aM.fine", ctrg)); // 在规则地方转换
System.out.println(WordUtils.initials(str1)); // 获取首字母
System.out.println(WordUtils.initials("Ben John Lee", null)); // 取每个单词的首字母
char[] ctr = {' ', '.'};
System.out.println(WordUtils.initials("Ben J.Lee", ctr)); // 按指定规则获取首字母
System.out.println(WordUtils.swapCase(str1)); // 大小写逆转
System.out.println(WordUtils.wrap(str2, 1)); // 解析\n和\t等字符}
单词处理功能
WOrD
Word
I am.Fine
w
BJL
BJL
WoRd
ghj
ui po
CollectionUtils
CollectionUtils.isNotEmpty(apply4CDtoList);
CollectionUtils.isEmpty(apply4CDtoList);
org.apache.commons等常用工具学习的更多相关文章
- Apache commons (Java常用工具包)简介
Apache Commons是一个非常有用的工具包,解决各种实际的通用问题,下面是一个简述表,详细信息访问http://jakarta.apache.org/commons/index.html Be ...
- Maven+Spring Batch+Apache Commons VF学习
Apache Commons VFS资料:例子:http://www.zihou.me/html/2011/04/12/3377.html详细例子:http://p7engqingyang.iteye ...
- Apache Commons 常用工具类整理
其实一直都在使用常用工具类,只是从没去整理过,今天空了把一些常用的整理一下吧 怎么使用的一看就明白,另外还有注释,最后的使用pom引入的jar包 public class ApacheCommonsT ...
- 编写更少量的代码:使用apache commons工具类库
Commons-configuration Commons-FileUpload Commons DbUtils Commons BeanUtils Commons CLI Commo ...
- linkin大话数据结构--apache commons工具类
Apache Commons包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动. 一.Commons BeanUtils 说明:针对Bean的一个工具集.由于Bean往往是有一堆ge ...
- apache commons类库的学习
原文地址http://www.tuicool.com/articles/iyEbquE 1.1. 开篇 在Java的世界,有很多(成千上万)开源的框架,有成功的,也有不那么成功的,有声名显赫的,也有默 ...
- 高性能jdbc封装工具 Apache Commons DbUtils 1.6(转载)
转载自原文地址:http://gao-xianglong.iteye.com/blog/2166444 前言 关于Apache的DbUtils中间件或许了解的人并不多,大部分开发人员在生成环境中更多的 ...
- Apache Commons 工具集使用简介
Apache Commons包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动.我选了一些比较常用的项目做简单介绍.文中用了很多网上现成的东西,我只是做了一个汇总整理. 一.Comm ...
- Apache Commons 工具类介绍及简单使用
转自:http://www.cnblogs.com/younggun/p/3247261.html Apache Commons包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动.下 ...
随机推荐
- Can peel peel solve pesticide problem
Can peel peel solve pesticide problem? Middle peasants medicinal modern agriculture more and more, t ...
- php字符串转数组
下面代码包括了含有中文汉字的字符. function str2arr($str) { $length = mb_strlen($str, 'utf-8'); $array = []; for ($i= ...
- Codeforces Round #245 (Div. 1) B. Working out (dp)
题目:http://codeforces.com/problemset/problem/429/B 第一个人初始位置在(1,1),他必须走到(n,m)只能往下或者往右 第二个人初始位置在(n,1),他 ...
- 18-09-13 机器人和服务器之间的ip配置和脚本的重启
问题9 服务器安装完毕后 怎么配置机器人客户端的配置ip
- 异常处理——java基础
Evernote Export 异常处理 异常处理的套路模板: try//创建异常处理{ throw new();//抛出异常 //一旦有异常, 抛出异常后,后面的语句不再执行 语句;{ …… ...
- 中国科学技术大学第五届信息安全大赛(hackergame2018自我总结)2
这一批题都是我不会的,只能把官方write-up放在这里了 1.FLXG 的秘密 ----------------------------------------------------------- ...
- linux定时清理日志
服务器硬盘较小,需要自动删除日志 1.编写find命令 首先编写需要删除文件的sh #删除50天前的日志 find */logs -mtime +50 -exec rm -f {} \; #注意目录 ...
- powerdesigner 使用心得 comment、name
一.表字段设计页面设置 注意:name列填写的是中文,这样方便在视图中显示,本人忘了所以现在写下来. 二.设置PowerDesigner模型视图中数据表显示列 1.Tools-Display Pref ...
- Find Longest common string
动态规划法: 用二维矩阵来的每个元素来代表两个字符串的字符匹配情况, LCS[i, j]= LCS[i-1, j-1] + 1 , if X[i-1] == Y[J-1]. LCS[i, j] =0 ...
- asp。net内置委托
Action与Func是APS.NET内置委托 //--------------无返回值的委托Action--------------------------- Action是无返回值的泛型委托 Ac ...