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包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动.下 ...
随机推荐
- PAT甲级 1001 A+B Format
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805528788582400 1001 A+B Format ( ...
- selenium的三种等待方式
selenium有三种等待方式 1.time.sleep() 设置等待最简单的方法就是强制等待,但一般不建议使用,可以在调试的时候进行使用 2.隐性等待 driver.implictily_wait( ...
- 学号 20175223 《Java程序设计》第9周学习总结
目录 教材学习内容总结 教材学习中的问题和解决过程 1. 输出文件时过多输出. 代码调试中的问题和解决过程 1. 问题:费马素性检验程序. [代码托管] 学习进度条 参考资料 目录 教材学习内容总结 ...
- Swing学习2——图标添加Icon接口使用
废话没有,看代码. 主要就是通过实现Icon接口在标签添加一个圆形图标,并在框架中显示. package com.sword.swing_test; import javax.swing.*; imp ...
- makefile笔记6 - makefile条件判断
使用条件判断,可以让 make 根据运行时的不同情况选择不同的执行分支.条件表达式可以是比较变量的值,或是变量和常量的值. 一.示例 下面的例子,判断\(\$\)(CC)变量是否"gcc&q ...
- BUAAOO P1-P3 Expression Dirivation
目录 1.问题描述 1.1.概念定义 7.程序度量 8.知识点笔记 1.运行 2.1.方法 2.2.检测相等性 2.3.空串与null串 2.4.使用StringBuilder构建字符串 2.5.使用 ...
- iOS开发之UIGestureRecognizer
一:首先查看一下关于UIGestureRecognizer的定义 //当前手势状态 typedef NS_ENUM(NSInteger, UIGestureRecognizerState) { //尚 ...
- 二叉搜索树(BST)的插入和删除递归实现
思路 二叉搜索树的插入 TreeNode InsertRec(rootNode, key) = if rootNode == NULL, return new Node(key) if key > ...
- GitHub看板系统(Project)
/********************************************************************** * GitHub看板系统(Project) * 说明: ...
- unsigned int reverse_bit(unsigned int value);
/*编写函数 unsigned int reverse_bit(unsigned int value); 这个函数的返回值吧value的二进制位模式从左到右翻转后的值. 如在32位机器上25这个值包含 ...