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包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动.下 ...
随机推荐
- Java中Json字符串转换为对象的方法(多层List集合)
借鉴自:http://www.jb51.net/article/91142.htm 在将json字符串转换成对象flightInfo时,当flightInfo对象中有List<flightCla ...
- Java 错误提示org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
java 操作excel文件 发布后报错 org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException XSS ...
- 下载MNIST数据集脚本input_data源码
# Copyright 2015 Google Inc. All Rights Reserved.## Licensed under the Apache License, Version 2.0 ( ...
- [ 转 ] RESTful
一.什么是RESTful 定义: REST全程是Representational State Transfer,表述性状态转移.它首次出现在2000年Roy Fielding的博士论文中,Roy Fi ...
- redis cluster的conf配置文件配置
redis cluster的conf配置文件配置 master配置文件如下: bind 127.0.0.1 port tcp-backlog timeout tcp-keepalive logleve ...
- xpath | 计算两个节点集
url = li.xpath("./div/div[2]/a/@href | ./div/div[2]/div[2]/a/@href").extract_first()
- 字符串与NUll的拼接问题
今天做项目,浏览器向后台传值的时候,碰到一个问题,声明变量的时候为null时,首次加载会报错.但是初始化一次后,就正常传值了,摸索了半天,终于找到问题所在.在此记录一下,谨记. 现在说说情况,我在JS ...
- 大数据 - hadoop基础概念 - HDFS
Hadoop之HDFS的概念及用法 1.概念介绍 Hadoop是Apache旗下的一个项目.他由HDFS.MapReduce.Hive.HBase和ZooKeeper等成员组成. HDFS是一个高度容 ...
- SQL注入之Sqli-labs系列第五十关,第五十一关,第五十二关,第五十三关(ORDER BY堆叠注入)
0x1第五十关 源码中使用的mysqli_multi_query()函数,而之前使用的是mysqli_query(),区别在于mysqli_multi_query()可以执行多个sql语句,而mysq ...
- iOS Property 关键字的使用
atomic和nonatomic用来决定编译器生成的getter和setter是否为原子操作. atomic 设置成员变量的@property属性时,默认为atomic,提供多线程安全 ...