diff --git a/quickstart.md b/quickstart.md index f75107a1..ca1432e7 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 dfcf7829..89d78511 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 afd1495d..c09506ba 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 fff57ff7..f413be17 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 717ddfe3..9738b50d 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 9405c91d..d5905117 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 31510408..090bbdfa 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 8210a190..25ed127d 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 3031048e..d0e1bd32 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 1fa78348..b9579b17 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())) {