mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-04 04:37:59 +08:00
add method
This commit is contained in:
parent
9070709dfc
commit
973c9c4227
@ -3,11 +3,13 @@
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# 5.5.5 (2020-12-17)
|
# 5.5.5 (2020-12-18)
|
||||||
|
|
||||||
### 新特性
|
### 新特性
|
||||||
* 【core 】 URLUtil.normalize新增重载(pr#233@Gitee)
|
* 【core 】 URLUtil.normalize新增重载(pr#233@Gitee)
|
||||||
* 【core 】 PathUtil增加isSub和toAbsNormal方法
|
* 【core 】 PathUtil增加isSub和toAbsNormal方法
|
||||||
|
* 【db 】 RedisDS实现序列化接口(pr#1323@Github)
|
||||||
|
* 【poi 】 StyleUtil增加getFormat方法(pr#235@Gitee)
|
||||||
|
|
||||||
### Bug修复
|
### Bug修复
|
||||||
* 【core 】 FileUtil.isSub相对路径判断问题(pr#1315@Github)
|
* 【core 】 FileUtil.isSub相对路径判断问题(pr#1315@Github)
|
||||||
|
@ -9,6 +9,7 @@ import redis.clients.jedis.JedisPoolConfig;
|
|||||||
import redis.clients.jedis.Protocol;
|
import redis.clients.jedis.Protocol;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jedis数据源
|
* Jedis数据源
|
||||||
@ -16,7 +17,7 @@ import java.io.Closeable;
|
|||||||
* @author looly
|
* @author looly
|
||||||
* @since 3.2.3
|
* @since 3.2.3
|
||||||
*/
|
*/
|
||||||
public class RedisDS implements Closeable, Serializable{
|
public class RedisDS implements Closeable, Serializable {
|
||||||
private static final long serialVersionUID = -5605411972456177456L;
|
private static final long serialVersionUID = -5605411972456177456L;
|
||||||
/** 默认配置文件 */
|
/** 默认配置文件 */
|
||||||
public final static String REDIS_CONFIG_PATH = "config/redis.setting";
|
public final static String REDIS_CONFIG_PATH = "config/redis.setting";
|
||||||
@ -30,7 +31,7 @@ public class RedisDS implements Closeable, Serializable{
|
|||||||
/**
|
/**
|
||||||
* 创建RedisDS,使用默认配置文件,默认分组
|
* 创建RedisDS,使用默认配置文件,默认分组
|
||||||
*
|
*
|
||||||
* @return {@link RedisDS}
|
* @return RedisDS
|
||||||
*/
|
*/
|
||||||
public static RedisDS create() {
|
public static RedisDS create() {
|
||||||
return new RedisDS();
|
return new RedisDS();
|
||||||
@ -40,7 +41,7 @@ public class RedisDS implements Closeable, Serializable{
|
|||||||
* 创建RedisDS,使用默认配置文件
|
* 创建RedisDS,使用默认配置文件
|
||||||
*
|
*
|
||||||
* @param group 配置文件中配置分组
|
* @param group 配置文件中配置分组
|
||||||
* @return {@link RedisDS}
|
* @return RedisDS
|
||||||
*/
|
*/
|
||||||
public static RedisDS create(String group) {
|
public static RedisDS create(String group) {
|
||||||
return new RedisDS(group);
|
return new RedisDS(group);
|
||||||
@ -51,7 +52,7 @@ public class RedisDS implements Closeable, Serializable{
|
|||||||
*
|
*
|
||||||
* @param setting 配置文件
|
* @param setting 配置文件
|
||||||
* @param group 配置文件中配置分组
|
* @param group 配置文件中配置分组
|
||||||
* @return {@link RedisDS}
|
* @return RedisDS
|
||||||
*/
|
*/
|
||||||
public static RedisDS create(Setting setting, String group) {
|
public static RedisDS create(Setting setting, String group) {
|
||||||
return new RedisDS(setting, group);
|
return new RedisDS(setting, group);
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package cn.hutool.poi.excel.style;
|
package cn.hutool.poi.excel.style;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
|
import org.apache.poi.ss.usermodel.DataFormat;
|
||||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||||
import org.apache.poi.ss.usermodel.Font;
|
import org.apache.poi.ss.usermodel.Font;
|
||||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
@ -10,8 +12,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
|||||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel样式工具类
|
* Excel样式工具类
|
||||||
*
|
*
|
||||||
@ -132,13 +132,13 @@ public class StyleUtil {
|
|||||||
* @return {@link Font}
|
* @return {@link Font}
|
||||||
*/
|
*/
|
||||||
public static Font setFontStyle(Font font, short color, short fontSize, String fontName) {
|
public static Font setFontStyle(Font font, short color, short fontSize, String fontName) {
|
||||||
if(color > 0) {
|
if (color > 0) {
|
||||||
font.setColor(color);
|
font.setColor(color);
|
||||||
}
|
}
|
||||||
if(fontSize > 0) {
|
if (fontSize > 0) {
|
||||||
font.setFontHeightInPoints(fontSize);
|
font.setFontHeightInPoints(fontSize);
|
||||||
}
|
}
|
||||||
if(StrUtil.isNotBlank(fontName)) {
|
if (StrUtil.isNotBlank(fontName)) {
|
||||||
font.setFontName(fontName);
|
font.setFontName(fontName);
|
||||||
}
|
}
|
||||||
return font;
|
return font;
|
||||||
@ -153,7 +153,7 @@ public class StyleUtil {
|
|||||||
* @since 5.4.0
|
* @since 5.4.0
|
||||||
*/
|
*/
|
||||||
public static CellStyle createCellStyle(Workbook workbook) {
|
public static CellStyle createCellStyle(Workbook workbook) {
|
||||||
if(null == workbook){
|
if (null == workbook) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return workbook.createCellStyle();
|
return workbook.createCellStyle();
|
||||||
@ -192,7 +192,8 @@ public class StyleUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 给定样式是否为null(无样式)或默认样式,默认样式为<code>workbook.getCellStyleAt(0)</code>
|
* 给定样式是否为null(无样式)或默认样式,默认样式为{@code workbook.getCellStyleAt(0)}
|
||||||
|
*
|
||||||
* @param workbook 工作簿
|
* @param workbook 工作簿
|
||||||
* @param style 被检查的样式
|
* @param style 被检查的样式
|
||||||
* @return 是否为null(无样式)或默认样式
|
* @return 是否为null(无样式)或默认样式
|
||||||
@ -201,4 +202,16 @@ public class StyleUtil {
|
|||||||
public static boolean isNullOrDefaultStyle(Workbook workbook, CellStyle style) {
|
public static boolean isNullOrDefaultStyle(Workbook workbook, CellStyle style) {
|
||||||
return (null == style) || style.equals(workbook.getCellStyleAt(0));
|
return (null == style) || style.equals(workbook.getCellStyleAt(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建数据格式并获取格式
|
||||||
|
*
|
||||||
|
* @param format 数据格式
|
||||||
|
* @return 数据格式
|
||||||
|
* @since 5.5.5
|
||||||
|
*/
|
||||||
|
public Short getFormat(Workbook workbook, String format) {
|
||||||
|
final DataFormat dataFormat = workbook.createDataFormat();
|
||||||
|
return dataFormat.getFormat(format);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user