From 1adb06af37c45efecc0dfafe9b7986014eef5ffe Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Wed, 28 Aug 2019 18:37:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E6=9E=84=E9=80=A0=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quickstart.md | 2 ++ src/main/java/com/alibaba/excel/metadata/BasicParameter.java | 3 +-- src/main/java/com/alibaba/excel/util/BooleanUtils.java | 2 ++ src/main/java/com/alibaba/excel/util/CollectionUtils.java | 4 +++- src/main/java/com/alibaba/excel/util/FileUtils.java | 2 ++ src/main/java/com/alibaba/excel/util/IoUtils.java | 2 ++ src/main/java/com/alibaba/excel/util/PositionUtils.java | 2 ++ src/main/java/com/alibaba/excel/util/StringUtils.java | 4 +++- src/main/java/com/alibaba/excel/util/StyleUtil.java | 2 ++ src/main/java/com/alibaba/excel/util/WorkBookUtil.java | 2 ++ 10 files changed, 21 insertions(+), 4 deletions(-) diff --git a/quickstart.md b/quickstart.md index f75107a..ca1432e 100644 --- a/quickstart.md +++ b/quickstart.md @@ -1,5 +1,7 @@ # easyexcel核心功能 ## 目录 +### 前言 +读写的对象都用到了[Lombok](https://www.projectlombok.org/),他会自动生成`get`,`set` ,如果不需要自己创建对象并生成`get`,`set` 。 ### 读 DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/java/com/alibaba/easyexcel/demo/read/ReadTest.java](/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java) * [最简单的读](#simpleRead) diff --git a/src/main/java/com/alibaba/excel/metadata/BasicParameter.java b/src/main/java/com/alibaba/excel/metadata/BasicParameter.java index dfcf782..89d7851 100644 --- a/src/main/java/com/alibaba/excel/metadata/BasicParameter.java +++ b/src/main/java/com/alibaba/excel/metadata/BasicParameter.java @@ -1,6 +1,5 @@ package com.alibaba.excel.metadata; -import java.util.ArrayList; import java.util.List; import com.alibaba.excel.converters.Converter; @@ -22,7 +21,7 @@ public class BasicParameter { /** * Custom type conversions override the default */ - private List customConverterList = new ArrayList(); + private List customConverterList; /** * Automatic trim includes sheet name and content */ diff --git a/src/main/java/com/alibaba/excel/util/BooleanUtils.java b/src/main/java/com/alibaba/excel/util/BooleanUtils.java index afd1495..c09506b 100644 --- a/src/main/java/com/alibaba/excel/util/BooleanUtils.java +++ b/src/main/java/com/alibaba/excel/util/BooleanUtils.java @@ -10,6 +10,8 @@ public class BooleanUtils { private static final String TRUE_NUMBER = "1"; private static final String FALSE_NUMBER = "0"; + private BooleanUtils() {} + /** * String to boolean * diff --git a/src/main/java/com/alibaba/excel/util/CollectionUtils.java b/src/main/java/com/alibaba/excel/util/CollectionUtils.java index fff57ff..f413be1 100644 --- a/src/main/java/com/alibaba/excel/util/CollectionUtils.java +++ b/src/main/java/com/alibaba/excel/util/CollectionUtils.java @@ -5,11 +5,13 @@ import java.util.Map; /** * Collection utils - * + * * @author jipengfei */ public class CollectionUtils { + private CollectionUtils() {} + public static boolean isEmpty(Collection collection) { return (collection == null || collection.isEmpty()); } diff --git a/src/main/java/com/alibaba/excel/util/FileUtils.java b/src/main/java/com/alibaba/excel/util/FileUtils.java index 717ddfe..9738b50 100644 --- a/src/main/java/com/alibaba/excel/util/FileUtils.java +++ b/src/main/java/com/alibaba/excel/util/FileUtils.java @@ -25,6 +25,8 @@ public class FileUtils { private static final String CACHE = "excache"; private static final int WRITE_BUFF_SIZE = 8192; + private FileUtils() {} + /** * Reads the contents of a file into a byte array. * The file is always closed. * diff --git a/src/main/java/com/alibaba/excel/util/IoUtils.java b/src/main/java/com/alibaba/excel/util/IoUtils.java index 9405c91..d590511 100644 --- a/src/main/java/com/alibaba/excel/util/IoUtils.java +++ b/src/main/java/com/alibaba/excel/util/IoUtils.java @@ -17,6 +17,8 @@ public class IoUtils { */ private static final int DEFAULT_BUFFER_SIZE = 1024 * 4; + private IoUtils() {} + /** * Gets the contents of an InputStream as a byte[]. * diff --git a/src/main/java/com/alibaba/excel/util/PositionUtils.java b/src/main/java/com/alibaba/excel/util/PositionUtils.java index 3151040..090bbdf 100644 --- a/src/main/java/com/alibaba/excel/util/PositionUtils.java +++ b/src/main/java/com/alibaba/excel/util/PositionUtils.java @@ -5,6 +5,8 @@ package com.alibaba.excel.util; */ public class PositionUtils { + private PositionUtils() {} + public static int getRow(String currentCellIndex) { int row = 0; if (currentCellIndex != null) { diff --git a/src/main/java/com/alibaba/excel/util/StringUtils.java b/src/main/java/com/alibaba/excel/util/StringUtils.java index 8210a19..25ed127 100644 --- a/src/main/java/com/alibaba/excel/util/StringUtils.java +++ b/src/main/java/com/alibaba/excel/util/StringUtils.java @@ -2,11 +2,13 @@ package com.alibaba.excel.util; /** * String utils - * + * * @author jipengfei */ public class StringUtils { + private StringUtils() {} + public static boolean isEmpty(Object str) { return (str == null || "".equals(str)); } diff --git a/src/main/java/com/alibaba/excel/util/StyleUtil.java b/src/main/java/com/alibaba/excel/util/StyleUtil.java index 3031048..d0e1bd3 100644 --- a/src/main/java/com/alibaba/excel/util/StyleUtil.java +++ b/src/main/java/com/alibaba/excel/util/StyleUtil.java @@ -17,6 +17,8 @@ import com.alibaba.excel.write.metadata.style.WriteFont; */ public class StyleUtil { + private StyleUtil() {} + /** * @param workbook * @return diff --git a/src/main/java/com/alibaba/excel/util/WorkBookUtil.java b/src/main/java/com/alibaba/excel/util/WorkBookUtil.java index 1fa7834..b9579b1 100644 --- a/src/main/java/com/alibaba/excel/util/WorkBookUtil.java +++ b/src/main/java/com/alibaba/excel/util/WorkBookUtil.java @@ -22,6 +22,8 @@ import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; */ public class WorkBookUtil { + private WorkBookUtil() {} + public static Workbook createWorkBook(WriteWorkbookHolder writeWorkbookHolder) throws IOException, InvalidFormatException { if (ExcelTypeEnum.XLSX.equals(writeWorkbookHolder.getExcelType())) {