From 7a6f1de3dfe72fd91cb7d008e376d65c34c0893f Mon Sep 17 00:00:00 2001
From: hee9841
Date: Wed, 14 May 2025 16:09:18 +0900
Subject: [PATCH 1/8] =?UTF-8?q?Rename:=20SXSSFExcelFile=20->=20SXSSFExport?=
=?UTF-8?q?er=EB=A1=9C=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/io/github/hee9841/excel/core/ExcelExporter.java | 6 +++---
.../core/{SXSSFExcelFile.java => SXSSFExporter.java} | 8 ++++----
.../excel/core/ExcelExporterByteOutputStreamTest.java | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
rename src/main/java/io/github/hee9841/excel/core/{SXSSFExcelFile.java => SXSSFExporter.java} (96%)
diff --git a/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java b/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
index bacaaff..788793e 100644
--- a/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
@@ -6,7 +6,7 @@
import java.util.List;
/**
- * ExcelExporter is a concrete implementation of {@link SXSSFExcelFile} that provides functionality
+ * ExcelExporter is a concrete implementation of {@link SXSSFExporter} that provides functionality
* for exporting data to Excel files. This class uses the SXSSFWorkbook from Apache POI for
* efficient
* handling of large datasets by streaming data to disk.
@@ -21,11 +21,11 @@
*
* @param The type of data to be exported to Excel. The type must be annotated appropriately
* for Excel column mapping using the library's annotation system.
- * @see SXSSFExcelFile
+ * @see SXSSFExporter
* @see ExcelExporterBuilder
* @see SheetStrategy
*/
-public class ExcelExporter extends SXSSFExcelFile {
+public class ExcelExporter extends SXSSFExporter {
private static final String EXCEED_MAX_ROW_MSG_2ARGS =
"The data size exceeds the maximum number of rows allowed per sheet. "
diff --git a/src/main/java/io/github/hee9841/excel/core/SXSSFExcelFile.java b/src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java
similarity index 96%
rename from src/main/java/io/github/hee9841/excel/core/SXSSFExcelFile.java
rename to src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java
index d7aecda..7d51fa9 100644
--- a/src/main/java/io/github/hee9841/excel/core/SXSSFExcelFile.java
+++ b/src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java
@@ -36,9 +36,9 @@
*
* @param The type of data to be handled in the Excel file
*/
-public abstract class SXSSFExcelFile implements ExcelFile {
+public abstract class SXSSFExporter implements ExcelFile {
- protected static final Logger logger = LoggerFactory.getLogger(SXSSFExcelFile.class);
+ protected static final Logger logger = LoggerFactory.getLogger(SXSSFExporter.class);
protected static final SpreadsheetVersion supplyExcelVersion = SpreadsheetVersion.EXCEL2007;
@@ -49,9 +49,9 @@ public abstract class SXSSFExcelFile implements ExcelFile {
protected String dtoTypeName;
/**
- * Constructs a new SXSSFExcelFile with a new SXSSFWorkbook instance.
+ * Constructs a new SXSSFExporter with a new SXSSFWorkbook instance.
*/
- protected SXSSFExcelFile() {
+ protected SXSSFExporter() {
this.workbook = new SXSSFWorkbook();
}
diff --git a/src/test/java/io/github/hee9841/excel/core/ExcelExporterByteOutputStreamTest.java b/src/test/java/io/github/hee9841/excel/core/ExcelExporterByteOutputStreamTest.java
index fb182b6..e194d2b 100644
--- a/src/test/java/io/github/hee9841/excel/core/ExcelExporterByteOutputStreamTest.java
+++ b/src/test/java/io/github/hee9841/excel/core/ExcelExporterByteOutputStreamTest.java
@@ -61,8 +61,8 @@ class ExcelExporterByteOutputStreamTest {
@BeforeEach
void beforeEach() {
- Logger logger = (Logger) LoggerFactory.getLogger(SXSSFExcelFile.class);
- loggerClassName = SXSSFExcelFile.class.getName();
+ Logger logger = (Logger) LoggerFactory.getLogger(SXSSFExporter.class);
+ loggerClassName = SXSSFExporter.class.getName();
memoryAppender = new MemoryAppender();
memoryAppender.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
logger.setLevel(Level.DEBUG);
From c55a08acc31f0be1411a84706bd0981c82d7ffbb Mon Sep 17 00:00:00 2001
From: hee9841
Date: Wed, 14 May 2025 16:22:32 +0900
Subject: [PATCH 2/8] =?UTF-8?q?Rename:=20ExcelExporter=20->=20DefaultExcel?=
=?UTF-8?q?Exporter=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
.../hee9841/excel/annotation/Excel.java | 2 +-
.../excel/core/DefaultExcelExporter.java | 204 ++++++++++++++++++
.../hee9841/excel/core/ExcelExporter.java | 75 +------
.../excel/core/ExcelExporterBuilder.java | 12 +-
.../github/hee9841/excel/core/ExcelFile.java | 35 ---
...ultExcelExporterByteOutputStreamTest.java} | 26 +--
7 files changed, 234 insertions(+), 122 deletions(-)
create mode 100644 src/main/java/io/github/hee9841/excel/core/DefaultExcelExporter.java
delete mode 100644 src/main/java/io/github/hee9841/excel/core/ExcelFile.java
rename src/test/java/io/github/hee9841/excel/core/{ExcelExporterByteOutputStreamTest.java => DefaultExcelExporterByteOutputStreamTest.java} (96%)
diff --git a/README.md b/README.md
index 25750de..6e898ef 100644
--- a/README.md
+++ b/README.md
@@ -105,7 +105,7 @@ List products = Arrays.asList(
);
// 3. Export to Excel
-ExcelExporter exporter = ExcelExporter.builder(Product.class, products)
+DefaultExcelExporter exporter = DefaultExcelExporter.builder(Product.class, products)
.sheetStrategy(SheetStrategy.MULTI_SHEET) // Optional, MULTI_SHEET is default
.maxRows(100) // Optional, Max row of SpreadsheetVersion.EXCEL2007 is default
.sheetName("Products") // Optional, if not specified sheets will be named Sheet0, Sheet1, etc.
diff --git a/src/main/java/io/github/hee9841/excel/annotation/Excel.java b/src/main/java/io/github/hee9841/excel/annotation/Excel.java
index ea79191..e4adf85 100644
--- a/src/main/java/io/github/hee9841/excel/annotation/Excel.java
+++ b/src/main/java/io/github/hee9841/excel/annotation/Excel.java
@@ -41,7 +41,7 @@
*
* // Usage example:
* List{@literal <}UserData{@literal >} users = getUserData();
- * ExcelExporter{@literal <}UserData{@literal >} exporter = ExcelExporter.builder(UserData.class, users)
+ * DefaultExcelExporter{@literal <}UserData{@literal >} exporter = DefaultExcelExporter.builder(UserData.class, users)
* .sheetName("Users")
* .build();
* exporter.write(new FileOutputStream("users.xlsx"));
diff --git a/src/main/java/io/github/hee9841/excel/core/DefaultExcelExporter.java b/src/main/java/io/github/hee9841/excel/core/DefaultExcelExporter.java
new file mode 100644
index 0000000..9e2be53
--- /dev/null
+++ b/src/main/java/io/github/hee9841/excel/core/DefaultExcelExporter.java
@@ -0,0 +1,204 @@
+package io.github.hee9841.excel.core;
+
+import io.github.hee9841.excel.exception.ExcelException;
+import io.github.hee9841.excel.strategy.SheetStrategy;
+import java.text.MessageFormat;
+import java.util.List;
+
+/**
+ * DefaultExcelExporter is a concrete implementation of {@link SXSSFExporter} that provides functionality
+ * for exporting data to Excel files. This class uses the SXSSFWorkbook from Apache POI for
+ * efficient
+ * handling of large datasets by streaming data to disk.
+ *
+ * The DefaultExcelExporter supports two sheet management strategies:
+ *
+ * - ONE_SHEET - All data is exported to a single sheet (limited by max rows per sheet)
+ * - MULTI_SHEET - Data is split across multiple sheets when exceeding max rows per sheet
+ *
+ *
+ * Use the {@link ExcelExporterBuilder} to configure and instantiate this class.
+ *
+ * @param The type of data to be exported to Excel. The type must be annotated appropriately
+ * for Excel column mapping using the library's annotation system.
+ * @see SXSSFExporter
+ * @see ExcelExporterBuilder
+ * @see SheetStrategy
+ */
+public class DefaultExcelExporter extends SXSSFExporter {
+
+ private static final String EXCEED_MAX_ROW_MSG_2ARGS =
+ "The data size exceeds the maximum number of rows allowed per sheet. "
+ + "The sheet strategy is set to ONE_SHEET but the data size is larger than "
+ + "the maximum rows per sheet (data size: {0}, maximum rows: {1} ).\n"
+ + "Please change the sheet strategy to MULTI_SHEET or reduce the data size.";
+
+ private static final int ROW_START_INDEX = 0;
+ private int currentRowIndex = ROW_START_INDEX;
+
+ private final String sheetName;
+ private final int maxRowsPerSheet;
+
+ private SheetStrategy sheetStrategy;
+ private int currentSheetIndex;
+
+
+ /**
+ * Constructs an DefaultExcelExporter with the specified configuration.
+ *
+ * This constructor is not meant to be called directly. Use {@link ExcelExporterBuilder}
+ * to create instances of DefaultExcelExporter.
+ *
+ * @param type The class type of the data to be exported
+ * @param data The list of data objects to be exported
+ * @param sheetStrategy The strategy for sheet management (ONE_SHEET or MULTI_SHEET)
+ * @param sheetName Base name for sheets (null for default names)
+ * @param maxRowsPerSheet Maximum number of rows allowed per sheet
+ */
+ DefaultExcelExporter(
+ Class type,
+ List data,
+ SheetStrategy sheetStrategy,
+ String sheetName,
+ int maxRowsPerSheet
+ ) {
+ super();
+ this.maxRowsPerSheet = maxRowsPerSheet;
+ this.sheetName = sheetName;
+ this.currentSheetIndex = 0;
+ setSheetStrategy(sheetStrategy);
+
+ this.initialize(type, data);
+ this.createExcelFile(data);
+ }
+
+
+ /**
+ * Creates a new builder for configuring and instantiating an DefaultExcelExporter.
+ *
+ * @param The type of data to be exported
+ * @param type The class of the data type
+ * @param data The list of data objects to be exported
+ * @return A new ExcelExporterBuilder instance
+ */
+ public static ExcelExporterBuilder builder(Class type, List data) {
+ return new ExcelExporterBuilder<>(type, data, supplyExcelVersion.getMaxRows());
+ }
+
+
+ /**
+ * Validates the data size against the maximum rows per sheet limit.
+ *
+ * This method checks if the data size exceeds the maximum allowed rows per sheet
+ * when using ONE_SHEET strategy. If the limit is exceeded, an ExcelException is thrown.
+ *
+ * @param type The class type of the data being validated
+ * @param data The list of data objects to be validated
+ * @throws ExcelException if data size exceeds max rows limit with ONE_SHEET strategy
+ */
+ @Override
+ protected void validate(Class> type, List data) {
+ if (SheetStrategy.isOneSheet(sheetStrategy) && data.size() > maxRowsPerSheet - 1) {
+ throw new ExcelException(
+ MessageFormat.format(EXCEED_MAX_ROW_MSG_2ARGS,
+ data.size(), maxRowsPerSheet
+ ), dtoTypeName);
+ }
+ }
+
+ /**
+ * Creates the Excel file with the provided data.
+ *
+ * This method handles the creation of sheets and rows based on the data:
+ *
+ * - If the data is empty, it creates a sheet with headers only
+ * - Otherwise, it creates a sheet with headers and adds all data rows
+ *
+ *
+ * @param data The list of data objects to be exported
+ */
+ @Override
+ protected void createExcelFile(List data) {
+ // 1. If data is empty, create createHeader only.
+ if (data.isEmpty()) {
+ createNewSheetWithHeader();
+ logger.warn("Empty data provided - Excel file will be created with headers only.");
+ return;
+ }
+
+ //2. Add rows
+ createNewSheetWithHeader();
+ addRows(data);
+ }
+
+ /**
+ * Adds rows to the current sheet for the provided data list.
+ *
+ * If the number of rows exceeds the maximum allowed per sheet and the sheet strategy
+ * is MULTI_SHEET, a new sheet will be created to continue adding rows.
+ *
+ * If the sheet strategy is ONE_SHEET and the data size exceeds the maximum rows per sheet,
+ * an ExcelException will be thrown.
+ *
+ * @param data The list of data objects to be added as rows
+ * @throws ExcelException if ONE_SHEET strategy is used and data exceeds max rows limit
+ */
+ @Override
+ public void addRows(List data) {
+ int leftDataSize = data.size();
+ for (Object renderedData : data) {
+ createBody(renderedData, currentRowIndex++);
+ leftDataSize--;
+ if (currentRowIndex == maxRowsPerSheet && leftDataSize > 0) {
+ //If one sheet strategy, throw exception
+ if (SheetStrategy.isOneSheet(sheetStrategy)) {
+ throw new ExcelException(
+ MessageFormat.format(EXCEED_MAX_ROW_MSG_2ARGS,
+ data.size(), maxRowsPerSheet), dtoTypeName);
+ }
+
+ //If multi sheet strategy, create new sheet
+ createNewSheetWithHeader();
+ }
+ }
+ }
+
+ /**
+ * Sets the sheet strategy for this exporter.
+ *
+ * This method also configures the workbook's Zip64 mode based on the selected strategy.
+ *
+ * @param strategy The sheet strategy to use (ONE_SHEET or MULTI_SHEET)-
+ */
+ private void setSheetStrategy(SheetStrategy strategy) {
+
+ this.sheetStrategy = strategy;
+ workbook.setZip64Mode(sheetStrategy.getZip64Mode());
+
+ logger.debug("Set sheet strategy and Zip64Mode - strategy: {}, Zip64Mode: {}.",
+ strategy.name(), sheetStrategy.getZip64Mode().name());
+ }
+
+ /**
+ * Creates a new sheet with headers.
+ *
+ * This method resets the current row index, creates a new sheet, and adds headers to it.
+ * If a sheet name is provided, it will be used as a base name with an index(index starts from
+ * 0) suffix.
+ */
+ private void createNewSheetWithHeader() {
+ currentRowIndex = ROW_START_INDEX;
+
+ //If sheet name is provided, create sheet with sheet name + idx
+ if (sheetName != null) {
+ sheet = workbook.createSheet(String.format("%s%d", sheetName, currentSheetIndex++));
+ } else {
+ sheet = workbook.createSheet();
+ }
+
+ logger.debug("Create new Sheet : {}.", sheet.getSheetName());
+
+ createHeaderWithNewSheet(sheet, ROW_START_INDEX);
+ currentRowIndex++;
+ }
+}
diff --git a/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java b/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
index 788793e..4d171cb 100644
--- a/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
@@ -1,8 +1,7 @@
package io.github.hee9841.excel.core;
-import io.github.hee9841.excel.exception.ExcelException;
-import io.github.hee9841.excel.strategy.SheetStrategy;
-import java.text.MessageFormat;
+import java.io.IOException;
+import java.io.OutputStream;
import java.util.List;
/**
@@ -132,73 +131,17 @@ protected void createExcelFile(List data) {
}
/**
- * Adds rows to the current sheet for the provided data list.
+ * Writes the Excel file content to the specified output stream.
*
- * If the number of rows exceeds the maximum allowed per sheet and the sheet strategy
- * is MULTI_SHEET, a new sheet will be created to continue adding rows.
- *
- * If the sheet strategy is ONE_SHEET and the data size exceeds the maximum rows per sheet,
- * an ExcelException will be thrown.
- *
- * @param data The list of data objects to be added as rows
- * @throws ExcelException if ONE_SHEET strategy is used and data exceeds max rows limit
+ * @param stream The output stream to write the Excel file to
+ * @throws IOException if an I/O error occurs during writing
*/
- @Override
- public void addRows(List data) {
- int leftDataSize = data.size();
- for (Object renderedData : data) {
- createBody(renderedData, currentRowIndex++);
- leftDataSize--;
- if (currentRowIndex == maxRowsPerSheet && leftDataSize > 0) {
- //If one sheet strategy, throw exception
- if (SheetStrategy.isOneSheet(sheetStrategy)) {
- throw new ExcelException(
- MessageFormat.format(EXCEED_MAX_ROW_MSG_2ARGS,
- data.size(), maxRowsPerSheet), dtoTypeName);
- }
-
- //If multi sheet strategy, create new sheet
- createNewSheetWithHeader();
- }
- }
- }
+ void write(OutputStream stream) throws IOException;
/**
- * Sets the sheet strategy for this exporter.
- *
- * This method also configures the workbook's Zip64 mode based on the selected strategy.
+ * Adds a list of data rows to the Excel file.
*
- * @param strategy The sheet strategy to use (ONE_SHEET or MULTI_SHEET)-
- */
- private void setSheetStrategy(SheetStrategy strategy) {
-
- this.sheetStrategy = strategy;
- workbook.setZip64Mode(sheetStrategy.getZip64Mode());
-
- logger.debug("Set sheet strategy and Zip64Mode - strategy: {}, Zip64Mode: {}.",
- strategy.name(), sheetStrategy.getZip64Mode().name());
- }
-
- /**
- * Creates a new sheet with headers.
- *
- * This method resets the current row index, creates a new sheet, and adds headers to it.
- * If a sheet name is provided, it will be used as a base name with an index(index starts from
- * 0) suffix.
+ * @param data The list of data objects to be added as rows
*/
- private void createNewSheetWithHeader() {
- currentRowIndex = ROW_START_INDEX;
-
- //If sheet name is provided, create sheet with sheet name + idx
- if (sheetName != null) {
- sheet = workbook.createSheet(String.format("%s%d", sheetName, currentSheetIndex++));
- } else {
- sheet = workbook.createSheet();
- }
-
- logger.debug("Create new Sheet : {}.", sheet.getSheetName());
-
- createHeaderWithNewSheet(sheet, ROW_START_INDEX);
- currentRowIndex++;
- }
+ void addRows(List data);
}
diff --git a/src/main/java/io/github/hee9841/excel/core/ExcelExporterBuilder.java b/src/main/java/io/github/hee9841/excel/core/ExcelExporterBuilder.java
index bcb8b2e..1b56605 100644
--- a/src/main/java/io/github/hee9841/excel/core/ExcelExporterBuilder.java
+++ b/src/main/java/io/github/hee9841/excel/core/ExcelExporterBuilder.java
@@ -5,7 +5,7 @@
import java.util.List;
/**
- * Builder class for creating and configuring {@link ExcelExporter} instances.
+ * Builder class for creating and configuring {@link DefaultExcelExporter} instances.
* This class implements the Builder pattern to provide a fluent interface for
* configuring Excel export settings.
*
@@ -18,7 +18,7 @@
*
* Example usage:
*
- * ExcelExporter<MyData> exporter = ExcelExporter.builder(MyData.class, dataList)
+ * DefaultExcelExporter<MyData> exporter = DefaultExcelExporter.builder(MyData.class, dataList)
* .sheetStrategy(SheetStrategy.ONE_SHEET)
* .maxRows(10000)
* .sheetName("MySheet")
@@ -105,12 +105,12 @@ public ExcelExporterBuilder sheetName(String sheetName) {
}
/**
- * Builds and returns a new ExcelExporter instance with the configured settings.
+ * Builds and returns a new DefaultExcelExporter instance with the configured settings.
*
- * @return A new ExcelExporter instance
+ * @return A new DefaultExcelExporter instance
*/
- public ExcelExporter build() {
- return new ExcelExporter(
+ public DefaultExcelExporter build() {
+ return new DefaultExcelExporter(
this.type,
this.data,
this.sheetStrategy,
diff --git a/src/main/java/io/github/hee9841/excel/core/ExcelFile.java b/src/main/java/io/github/hee9841/excel/core/ExcelFile.java
deleted file mode 100644
index 676db1e..0000000
--- a/src/main/java/io/github/hee9841/excel/core/ExcelFile.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package io.github.hee9841.excel.core;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-
-/**
- * Core interface for Excel file operations in the library.
- * This interface defines the basic contract for Excel file handling operations.
- *
- * Implementations of this interface provide functionality for:
- *
- * - Writing Excel data to an output stream
- * - Adding rows of data to the Excel file
- *
- *
- * @param The type of data to be handled in the Excel file
- */
-public interface ExcelFile {
-
- /**
- * Writes the Excel file content to the specified output stream.
- *
- * @param stream The output stream to write the Excel file to
- * @throws IOException if an I/O error occurs during writing
- */
- void write(OutputStream stream) throws IOException;
-
- /**
- * Adds a list of data rows to the Excel file.
- *
- * @param data The list of data objects to be added as rows
- */
- void addRows(List data);
-}
diff --git a/src/test/java/io/github/hee9841/excel/core/ExcelExporterByteOutputStreamTest.java b/src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java
similarity index 96%
rename from src/test/java/io/github/hee9841/excel/core/ExcelExporterByteOutputStreamTest.java
rename to src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java
index e194d2b..d31695f 100644
--- a/src/test/java/io/github/hee9841/excel/core/ExcelExporterByteOutputStreamTest.java
+++ b/src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java
@@ -52,8 +52,8 @@
import org.slf4j.LoggerFactory;
-@DisplayName("ExcelExporter 테스트")
-class ExcelExporterByteOutputStreamTest {
+@DisplayName("DefaultExcelExporter 테스트")
+class DefaultExcelExporterByteOutputStreamTest {
MemoryAppender memoryAppender;
String loggerClassName;
@@ -92,7 +92,7 @@ void dataSizeExceedMaxRowsThrowsException() {
// when & then
ExcelException exception = assertThrows(ExcelException.class, () ->
- ExcelExporter.builder(TestDto.class, data)
+ DefaultExcelExporter.builder(TestDto.class, data)
.maxRows(maxRows)
.sheetStrategy(
SheetStrategy.ONE_SHEET) // Force ONE_SHEET strategy to ensure exception is thrown
@@ -113,7 +113,7 @@ void cannotExceedMaxRowOfImplementation() {
int maxRowOfExcel2007 = 0x100000; // Excel 2007 최대 행 수 초과
// when
- ExcelException exception = assertThrows(ExcelException.class, () -> ExcelExporter
+ ExcelException exception = assertThrows(ExcelException.class, () -> DefaultExcelExporter
.builder(TestDto.class, data)
.maxRows(maxRowOfExcel2007 + 1)
.build());
@@ -131,7 +131,7 @@ void validateLogSequence() throws IOException {
data.add(new TestDto("test1", 1));
data.add(new TestDto("test2", 2));
- ExcelExporter exporter = ExcelExporter
+ DefaultExcelExporter exporter = DefaultExcelExporter
.builder(TestDto.class, data).build();
exporter.write(os);
@@ -157,7 +157,7 @@ void createEmptyExcelFile() throws IOException {
// given
List emptyData = new ArrayList<>();
- ExcelExporter exporter = ExcelExporter
+ DefaultExcelExporter exporter = DefaultExcelExporter
.builder(TestDto.class, emptyData)
.build();
@@ -193,7 +193,7 @@ void multiSheetMaxRowsExceedTest() throws IOException {
testData.add(new TestDto("test" + (i + 1), i + 1));
}
// when
- ExcelExporter.builder(TestDto.class, testData)
+ DefaultExcelExporter.builder(TestDto.class, testData)
.maxRows(10)
.build().write(os);
@@ -237,7 +237,7 @@ void throwExceptionWhenOneSheetAndExceedMaxRows() {
//when
ExcelException exception = assertThrows(ExcelException.class,
- () -> ExcelExporter.builder(TestDto.class, testData)
+ () -> DefaultExcelExporter.builder(TestDto.class, testData)
.maxRows(10)
.sheetStrategy(SheetStrategy.ONE_SHEET)
.build()
@@ -265,7 +265,7 @@ void createSheetWithSpecifiedName() throws IOException {
}
//when
- ExcelExporter.builder(TestDto.class, testData)
+ DefaultExcelExporter.builder(TestDto.class, testData)
.sheetName("TestSheet")
.maxRows(10)
.build()
@@ -300,7 +300,7 @@ void checkFormulaType() throws IOException {
}
//when
- ExcelExporter.builder(TypeAutoDto.class, testData)
+ DefaultExcelExporter.builder(TypeAutoDto.class, testData)
.sheetName("TestSheet")
.build()
.write(os);
@@ -346,7 +346,7 @@ class TestDto {
testData.add(new TestDto());
//when
- ExcelExporter.builder(TestDto.class, testData)
+ DefaultExcelExporter.builder(TestDto.class, testData)
.build()
.write(os);
@@ -402,7 +402,7 @@ void createExcelFileWithSpecifiedCellStyle() throws IOException {
testData.add(new TestDto("name value", 1));
//when
- ExcelExporter.builder(TestDto.class, testData)
+ DefaultExcelExporter.builder(TestDto.class, testData)
.build()
.write(os);
@@ -454,7 +454,7 @@ void createExcelFileWithSpecifiedDataFormat() throws IOException {
String signUpDatePattern = CellFormats.DEFAULT_DATE_FORMAT;
//when
- ExcelExporter.builder(TestDto.class, testData)
+ DefaultExcelExporter.builder(TestDto.class, testData)
.build()
.write(os);
From d6a98deca2eaf75b3d7ed00fbe69fe77a140cd75 Mon Sep 17 00:00:00 2001
From: hee9841
Date: Wed, 14 May 2025 16:23:14 +0900
Subject: [PATCH 3/8] =?UTF-8?q?Rename:=20ExcelFile=20->=20ExcelExporter=20?=
=?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../hee9841/excel/core/ExcelExporter.java | 126 +-----------------
.../hee9841/excel/core/SXSSFExporter.java | 2 +-
2 files changed, 8 insertions(+), 120 deletions(-)
diff --git a/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java b/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
index 4d171cb..cad367f 100644
--- a/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
@@ -5,130 +5,18 @@
import java.util.List;
/**
- * ExcelExporter is a concrete implementation of {@link SXSSFExporter} that provides functionality
- * for exporting data to Excel files. This class uses the SXSSFWorkbook from Apache POI for
- * efficient
- * handling of large datasets by streaming data to disk.
+ * Core interface for Excel file operations in the library.
+ * This interface defines the basic contract for Excel file handling operations.
*
- * The ExcelExporter supports two sheet management strategies:
+ * Implementations of this interface provide functionality for:
*
- * - ONE_SHEET - All data is exported to a single sheet (limited by max rows per sheet)
- * - MULTI_SHEET - Data is split across multiple sheets when exceeding max rows per sheet
+ * - Writing Excel data to an output stream
+ * - Adding rows of data to the Excel file
*
*
- * Use the {@link ExcelExporterBuilder} to configure and instantiate this class.
- *
- * @param The type of data to be exported to Excel. The type must be annotated appropriately
- * for Excel column mapping using the library's annotation system.
- * @see SXSSFExporter
- * @see ExcelExporterBuilder
- * @see SheetStrategy
+ * @param The type of data to be handled in the Excel file
*/
-public class ExcelExporter extends SXSSFExporter {
-
- private static final String EXCEED_MAX_ROW_MSG_2ARGS =
- "The data size exceeds the maximum number of rows allowed per sheet. "
- + "The sheet strategy is set to ONE_SHEET but the data size is larger than "
- + "the maximum rows per sheet (data size: {0}, maximum rows: {1} ).\n"
- + "Please change the sheet strategy to MULTI_SHEET or reduce the data size.";
-
- private static final int ROW_START_INDEX = 0;
- private int currentRowIndex = ROW_START_INDEX;
-
- private final String sheetName;
- private final int maxRowsPerSheet;
-
- private SheetStrategy sheetStrategy;
- private int currentSheetIndex;
-
-
- /**
- * Constructs an ExcelExporter with the specified configuration.
- *
- * This constructor is not meant to be called directly. Use {@link ExcelExporterBuilder}
- * to create instances of ExcelExporter.
- *
- * @param type The class type of the data to be exported
- * @param data The list of data objects to be exported
- * @param sheetStrategy The strategy for sheet management (ONE_SHEET or MULTI_SHEET)
- * @param sheetName Base name for sheets (null for default names)
- * @param maxRowsPerSheet Maximum number of rows allowed per sheet
- */
- ExcelExporter(
- Class type,
- List data,
- SheetStrategy sheetStrategy,
- String sheetName,
- int maxRowsPerSheet
- ) {
- super();
- this.maxRowsPerSheet = maxRowsPerSheet;
- this.sheetName = sheetName;
- this.currentSheetIndex = 0;
- setSheetStrategy(sheetStrategy);
-
- this.initialize(type, data);
- this.createExcelFile(data);
- }
-
-
- /**
- * Creates a new builder for configuring and instantiating an ExcelExporter.
- *
- * @param The type of data to be exported
- * @param type The class of the data type
- * @param data The list of data objects to be exported
- * @return A new ExcelExporterBuilder instance
- */
- public static ExcelExporterBuilder builder(Class type, List data) {
- return new ExcelExporterBuilder<>(type, data, supplyExcelVersion.getMaxRows());
- }
-
-
- /**
- * Validates the data size against the maximum rows per sheet limit.
- *
- * This method checks if the data size exceeds the maximum allowed rows per sheet
- * when using ONE_SHEET strategy. If the limit is exceeded, an ExcelException is thrown.
- *
- * @param type The class type of the data being validated
- * @param data The list of data objects to be validated
- * @throws ExcelException if data size exceeds max rows limit with ONE_SHEET strategy
- */
- @Override
- protected void validate(Class> type, List data) {
- if (SheetStrategy.isOneSheet(sheetStrategy) && data.size() > maxRowsPerSheet - 1) {
- throw new ExcelException(
- MessageFormat.format(EXCEED_MAX_ROW_MSG_2ARGS,
- data.size(), maxRowsPerSheet
- ), dtoTypeName);
- }
- }
-
- /**
- * Creates the Excel file with the provided data.
- *
- * This method handles the creation of sheets and rows based on the data:
- *
- * - If the data is empty, it creates a sheet with headers only
- * - Otherwise, it creates a sheet with headers and adds all data rows
- *
- *
- * @param data The list of data objects to be exported
- */
- @Override
- protected void createExcelFile(List data) {
- // 1. If data is empty, create createHeader only.
- if (data.isEmpty()) {
- createNewSheetWithHeader();
- logger.warn("Empty data provided - Excel file will be created with headers only.");
- return;
- }
-
- //2. Add rows
- createNewSheetWithHeader();
- addRows(data);
- }
+public interface ExcelExporter {
/**
* Writes the Excel file content to the specified output stream.
diff --git a/src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java b/src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java
index 7d51fa9..6bad8ea 100644
--- a/src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java
@@ -36,7 +36,7 @@
*
* @param The type of data to be handled in the Excel file
*/
-public abstract class SXSSFExporter implements ExcelFile {
+public abstract class SXSSFExporter implements ExcelExporter {
protected static final Logger logger = LoggerFactory.getLogger(SXSSFExporter.class);
From 5108c446f1297bc9ccf8d5430cf2b492f6c49734 Mon Sep 17 00:00:00 2001
From: hee9841
Date: Wed, 14 May 2025 16:25:43 +0900
Subject: [PATCH 4/8] =?UTF-8?q?Rename:=20=EC=97=91=EC=85=80=20exporter=20?=
=?UTF-8?q?=EA=B4=80=EB=A0=A8=20=ED=81=B4=EB=9E=98=EC=8A=A4=20core=20->=20?=
=?UTF-8?q?core.exporter=EB=A1=9C=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?=
=?UTF-8?q?=EC=9D=B4=EB=8F=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../hee9841/excel/core/{ => exporter}/DefaultExcelExporter.java | 2 +-
.../github/hee9841/excel/core/{ => exporter}/ExcelExporter.java | 2 +-
.../hee9841/excel/core/{ => exporter}/ExcelExporterBuilder.java | 2 +-
.../github/hee9841/excel/core/{ => exporter}/SXSSFExporter.java | 2 +-
.../excel/core/DefaultExcelExporterByteOutputStreamTest.java | 2 ++
5 files changed, 6 insertions(+), 4 deletions(-)
rename src/main/java/io/github/hee9841/excel/core/{ => exporter}/DefaultExcelExporter.java (99%)
rename src/main/java/io/github/hee9841/excel/core/{ => exporter}/ExcelExporter.java (95%)
rename src/main/java/io/github/hee9841/excel/core/{ => exporter}/ExcelExporterBuilder.java (98%)
rename src/main/java/io/github/hee9841/excel/core/{ => exporter}/SXSSFExporter.java (99%)
diff --git a/src/main/java/io/github/hee9841/excel/core/DefaultExcelExporter.java b/src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporter.java
similarity index 99%
rename from src/main/java/io/github/hee9841/excel/core/DefaultExcelExporter.java
rename to src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporter.java
index 9e2be53..5b7552f 100644
--- a/src/main/java/io/github/hee9841/excel/core/DefaultExcelExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporter.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.core;
+package io.github.hee9841.excel.core.exporter;
import io.github.hee9841.excel.exception.ExcelException;
import io.github.hee9841.excel.strategy.SheetStrategy;
diff --git a/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java b/src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporter.java
similarity index 95%
rename from src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
rename to src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporter.java
index cad367f..30903d5 100644
--- a/src/main/java/io/github/hee9841/excel/core/ExcelExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporter.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.core;
+package io.github.hee9841.excel.core.exporter;
import java.io.IOException;
import java.io.OutputStream;
diff --git a/src/main/java/io/github/hee9841/excel/core/ExcelExporterBuilder.java b/src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporterBuilder.java
similarity index 98%
rename from src/main/java/io/github/hee9841/excel/core/ExcelExporterBuilder.java
rename to src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporterBuilder.java
index 1b56605..19ef2ce 100644
--- a/src/main/java/io/github/hee9841/excel/core/ExcelExporterBuilder.java
+++ b/src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporterBuilder.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.core;
+package io.github.hee9841.excel.core.exporter;
import io.github.hee9841.excel.exception.ExcelException;
import io.github.hee9841.excel.strategy.SheetStrategy;
diff --git a/src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java b/src/main/java/io/github/hee9841/excel/core/exporter/SXSSFExporter.java
similarity index 99%
rename from src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java
rename to src/main/java/io/github/hee9841/excel/core/exporter/SXSSFExporter.java
index 6bad8ea..a544898 100644
--- a/src/main/java/io/github/hee9841/excel/core/SXSSFExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/exporter/SXSSFExporter.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.core;
+package io.github.hee9841.excel.core.exporter;
import io.github.hee9841.excel.exception.ExcelException;
import io.github.hee9841.excel.meta.ColumnInfo;
diff --git a/src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java b/src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java
index d31695f..e9bcbb0 100644
--- a/src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java
+++ b/src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java
@@ -12,6 +12,8 @@
import io.github.hee9841.excel.annotation.Excel;
import io.github.hee9841.excel.annotation.ExcelColumn;
import io.github.hee9841.excel.annotation.ExcelColumnStyle;
+import io.github.hee9841.excel.core.exporter.DefaultExcelExporter;
+import io.github.hee9841.excel.core.exporter.SXSSFExporter;
import io.github.hee9841.excel.example.dto.TypeAutoDto;
import io.github.hee9841.excel.example.style.EnumCellStyleExample;
import io.github.hee9841.excel.exception.ExcelException;
From 375683457d7579da41cb759a9ca9db81569f01ff Mon Sep 17 00:00:00 2001
From: hee9841
Date: Wed, 14 May 2025 16:47:34 +0900
Subject: [PATCH 5/8] Rename: ExcelExporterBuilder ->
DefaultExcelExporterBuilder
---
.../excel/core/exporter/DefaultExcelExporter.java | 12 ++++++------
...Builder.java => DefaultExcelExporterBuilder.java} | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
rename src/main/java/io/github/hee9841/excel/core/exporter/{ExcelExporterBuilder.java => DefaultExcelExporterBuilder.java} (90%)
diff --git a/src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporter.java b/src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporter.java
index 5b7552f..a75fe65 100644
--- a/src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporter.java
@@ -17,12 +17,12 @@
* MULTI_SHEET - Data is split across multiple sheets when exceeding max rows per sheet
*
*
- * Use the {@link ExcelExporterBuilder} to configure and instantiate this class.
+ * Use the {@link DefaultExcelExporterBuilder} to configure and instantiate this class.
*
* @param The type of data to be exported to Excel. The type must be annotated appropriately
* for Excel column mapping using the library's annotation system.
* @see SXSSFExporter
- * @see ExcelExporterBuilder
+ * @see DefaultExcelExporterBuilder
* @see SheetStrategy
*/
public class DefaultExcelExporter extends SXSSFExporter {
@@ -46,7 +46,7 @@ public class DefaultExcelExporter extends SXSSFExporter {
/**
* Constructs an DefaultExcelExporter with the specified configuration.
*
- * This constructor is not meant to be called directly. Use {@link ExcelExporterBuilder}
+ *
This constructor is not meant to be called directly. Use {@link DefaultExcelExporterBuilder}
* to create instances of DefaultExcelExporter.
*
* @param type The class type of the data to be exported
@@ -79,10 +79,10 @@ public class DefaultExcelExporter extends SXSSFExporter {
* @param The type of data to be exported
* @param type The class of the data type
* @param data The list of data objects to be exported
- * @return A new ExcelExporterBuilder instance
+ * @return A new DefaultExcelExporterBuilder instance
*/
- public static ExcelExporterBuilder builder(Class type, List data) {
- return new ExcelExporterBuilder<>(type, data, supplyExcelVersion.getMaxRows());
+ public static DefaultExcelExporterBuilder builder(Class type, List data) {
+ return new DefaultExcelExporterBuilder<>(type, data, supplyExcelVersion.getMaxRows());
}
diff --git a/src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporterBuilder.java b/src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporterBuilder.java
similarity index 90%
rename from src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporterBuilder.java
rename to src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporterBuilder.java
index 19ef2ce..c9519cf 100644
--- a/src/main/java/io/github/hee9841/excel/core/exporter/ExcelExporterBuilder.java
+++ b/src/main/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporterBuilder.java
@@ -27,7 +27,7 @@
*
* @param The type of data to be exported
*/
-public class ExcelExporterBuilder {
+public class DefaultExcelExporterBuilder {
private final Class type;
private final List data;
@@ -39,13 +39,13 @@ public class ExcelExporterBuilder {
private String sheetName;
/**
- * Constructs a new ExcelExporterBuilder with the specified type and data.
+ * Constructs a new DefaultExcelExporterBuilder with the specified type and data.
*
* @param type The class type of the data to be exported
* @param data The list of data objects to be exported
* @param supplyExcelMaxRows The maximum number of rows supported by the Excel version
*/
- ExcelExporterBuilder(
+ DefaultExcelExporterBuilder(
Class type,
List data,
int supplyExcelMaxRows
@@ -64,7 +64,7 @@ public class ExcelExporterBuilder {
* @param sheetStrategy The strategy to use for sheet management (ONE_SHEET or MULTI_SHEET)
* @return This builder instance for method chaining
*/
- public ExcelExporterBuilder sheetStrategy(SheetStrategy sheetStrategy) {
+ public DefaultExcelExporterBuilder sheetStrategy(SheetStrategy sheetStrategy) {
this.sheetStrategy = sheetStrategy;
return this;
}
@@ -76,7 +76,7 @@ public ExcelExporterBuilder sheetStrategy(SheetStrategy sheetStrategy) {
* @return This builder instance for method chaining
* @throws ExcelException if maxRowsPerSheet exceeds the Excel version's maximum row limit
*/
- public ExcelExporterBuilder maxRows(int maxRowsPerSheet) {
+ public DefaultExcelExporterBuilder maxRows(int maxRowsPerSheet) {
if (maxRowsPerSheet > supplyExcelMaxRows) {
throw new ExcelException(String.format(
"The maximum rows per sheet(%d) cannot exceed the supplied Excel sheet version's maximum row limit(%d).",
@@ -99,7 +99,7 @@ public ExcelExporterBuilder maxRows(int maxRowsPerSheet) {
* @param sheetName The base name for sheets
* @return This builder instance for method chaining
*/
- public ExcelExporterBuilder sheetName(String sheetName) {
+ public DefaultExcelExporterBuilder sheetName(String sheetName) {
this.sheetName = sheetName;
return this;
}
From f1e8aa1af97be410177143ed58cb86c85b63054c Mon Sep 17 00:00:00 2001
From: hee9841
Date: Fri, 12 Sep 2025 11:32:34 +0900
Subject: [PATCH 6/8] =?UTF-8?q?Rename=20:=20core=EC=97=90=20Exporter?=
=?UTF-8?q?=EA=B4=80=EB=A0=A8=20=ED=81=B4=EB=9E=98=EC=8A=A4=20core.exporte?=
=?UTF-8?q?r=EB=A1=9C=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=9D=B4=EB=8F=99,?=
=?UTF-8?q?=20meta=20=ED=8C=A8=ED=82=A4=EC=A7=80=20core=20=ED=8C=A8?=
=?UTF-8?q?=ED=82=A4=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../github/hee9841/excel/annotation/ExcelColumn.java | 2 +-
.../hee9841/excel/core/exporter/SXSSFExporter.java | 4 ++--
.../hee9841/excel/{ => core}/meta/ColumnDataType.java | 8 +++++++-
.../hee9841/excel/{ => core}/meta/ColumnInfo.java | 2 +-
.../excel/{ => core}/meta/ColumnInfoMapper.java | 2 +-
.../hee9841/excel/strategy/CellTypeStrategy.java | 11 +++++------
.../hee9841/excel/strategy/ColumnIndexStrategy.java | 2 +-
.../hee9841/excel/strategy/DataFormatStrategy.java | 10 ++++------
.../github/hee9841/excel/strategy/SheetStrategy.java | 1 +
.../DefaultExcelExporterByteOutputStreamTest.java | 4 +---
.../excel/{ => core}/meta/CellStyleMappingTest.java | 2 +-
.../excel/{ => core}/meta/ColumnDataTypeTest.java | 2 +-
.../excel/{ => core}/meta/ColumnInfoMapperTest.java | 2 +-
.../github/hee9841/excel/example/dto/TypeAutoDto.java | 2 +-
14 files changed, 28 insertions(+), 26 deletions(-)
rename src/main/java/io/github/hee9841/excel/{ => core}/meta/ColumnDataType.java (99%)
rename src/main/java/io/github/hee9841/excel/{ => core}/meta/ColumnInfo.java (98%)
rename src/main/java/io/github/hee9841/excel/{ => core}/meta/ColumnInfoMapper.java (99%)
rename src/test/java/io/github/hee9841/excel/core/{ => exporter}/DefaultExcelExporterByteOutputStreamTest.java (99%)
rename src/test/java/io/github/hee9841/excel/{ => core}/meta/CellStyleMappingTest.java (99%)
rename src/test/java/io/github/hee9841/excel/{ => core}/meta/ColumnDataTypeTest.java (99%)
rename src/test/java/io/github/hee9841/excel/{ => core}/meta/ColumnInfoMapperTest.java (99%)
diff --git a/src/main/java/io/github/hee9841/excel/annotation/ExcelColumn.java b/src/main/java/io/github/hee9841/excel/annotation/ExcelColumn.java
index d1ee435..70b0feb 100644
--- a/src/main/java/io/github/hee9841/excel/annotation/ExcelColumn.java
+++ b/src/main/java/io/github/hee9841/excel/annotation/ExcelColumn.java
@@ -1,7 +1,7 @@
package io.github.hee9841.excel.annotation;
import io.github.hee9841.excel.format.CellFormats;
-import io.github.hee9841.excel.meta.ColumnDataType;
+import io.github.hee9841.excel.core.meta.ColumnDataType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/src/main/java/io/github/hee9841/excel/core/exporter/SXSSFExporter.java b/src/main/java/io/github/hee9841/excel/core/exporter/SXSSFExporter.java
index a544898..3b6c0d1 100644
--- a/src/main/java/io/github/hee9841/excel/core/exporter/SXSSFExporter.java
+++ b/src/main/java/io/github/hee9841/excel/core/exporter/SXSSFExporter.java
@@ -1,8 +1,8 @@
package io.github.hee9841.excel.core.exporter;
import io.github.hee9841.excel.exception.ExcelException;
-import io.github.hee9841.excel.meta.ColumnInfo;
-import io.github.hee9841.excel.meta.ColumnInfoMapper;
+import io.github.hee9841.excel.core.meta.ColumnInfo;
+import io.github.hee9841.excel.core.meta.ColumnInfoMapper;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
diff --git a/src/main/java/io/github/hee9841/excel/meta/ColumnDataType.java b/src/main/java/io/github/hee9841/excel/core/meta/ColumnDataType.java
similarity index 99%
rename from src/main/java/io/github/hee9841/excel/meta/ColumnDataType.java
rename to src/main/java/io/github/hee9841/excel/core/meta/ColumnDataType.java
index 6b0d000..a614757 100644
--- a/src/main/java/io/github/hee9841/excel/meta/ColumnDataType.java
+++ b/src/main/java/io/github/hee9841/excel/core/meta/ColumnDataType.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.meta;
+package io.github.hee9841.excel.core.meta;
import io.github.hee9841.excel.annotation.ExcelColumnStyle;
import io.github.hee9841.excel.exception.ExcelException;
@@ -30,10 +30,12 @@ public enum ColumnDataType {
* Automatically determine the cell type based on the field type
*/
AUTO,
+
/**
* No specific cell type (default)
*/
_NONE,
+
/**
* Numeric cell type for various number formats
*/
@@ -50,6 +52,7 @@ public enum ColumnDataType {
CellFormats._NONE,
true
),
+
/**
* Boolean cell type
*/
@@ -61,6 +64,7 @@ public enum ColumnDataType {
CellFormats._NONE,
true
),
+
/**
* String cell type for text values
*/
@@ -72,6 +76,7 @@ public enum ColumnDataType {
CellFormats._NONE,
true
),
+
/**
* Enum cell type - uses toString() to get the value
*/
@@ -81,6 +86,7 @@ public enum ColumnDataType {
CellFormats._NONE,
true
),
+
/**
* Formula cell type - value is treated as an Excel formula
*/
diff --git a/src/main/java/io/github/hee9841/excel/meta/ColumnInfo.java b/src/main/java/io/github/hee9841/excel/core/meta/ColumnInfo.java
similarity index 98%
rename from src/main/java/io/github/hee9841/excel/meta/ColumnInfo.java
rename to src/main/java/io/github/hee9841/excel/core/meta/ColumnInfo.java
index 8329fb2..179cd4b 100644
--- a/src/main/java/io/github/hee9841/excel/meta/ColumnInfo.java
+++ b/src/main/java/io/github/hee9841/excel/core/meta/ColumnInfo.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.meta;
+package io.github.hee9841.excel.core.meta;
import io.github.hee9841.excel.annotation.ExcelColumnStyle;
import org.apache.poi.ss.usermodel.CellStyle;
diff --git a/src/main/java/io/github/hee9841/excel/meta/ColumnInfoMapper.java b/src/main/java/io/github/hee9841/excel/core/meta/ColumnInfoMapper.java
similarity index 99%
rename from src/main/java/io/github/hee9841/excel/meta/ColumnInfoMapper.java
rename to src/main/java/io/github/hee9841/excel/core/meta/ColumnInfoMapper.java
index b56ed60..fd327b6 100644
--- a/src/main/java/io/github/hee9841/excel/meta/ColumnInfoMapper.java
+++ b/src/main/java/io/github/hee9841/excel/core/meta/ColumnInfoMapper.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.meta;
+package io.github.hee9841.excel.core.meta;
import static io.github.hee9841.excel.global.SystemValues.ALLOWED_FIELD_TYPES;
import static io.github.hee9841.excel.global.SystemValues.ALLOWED_FIELD_TYPES_STRING;
diff --git a/src/main/java/io/github/hee9841/excel/strategy/CellTypeStrategy.java b/src/main/java/io/github/hee9841/excel/strategy/CellTypeStrategy.java
index 6a51f44..7bc79e4 100644
--- a/src/main/java/io/github/hee9841/excel/strategy/CellTypeStrategy.java
+++ b/src/main/java/io/github/hee9841/excel/strategy/CellTypeStrategy.java
@@ -1,13 +1,12 @@
package io.github.hee9841.excel.strategy;
-import io.github.hee9841.excel.meta.ColumnDataType;
/**
* Strategy enum that determines how cell types are assigned in Excel sheets.
*
* This enum defines strategies for determining the data type and format of cells
* when exporting data to Excel. It works in conjunction with the
- * {@link ColumnDataType} enum to control how different Java types
+ * {@link io.github.hee9841.excel.core.meta.ColumnDataType} enum to control how different Java types
* are represented in Excel.
*
* The available strategies are:
@@ -26,8 +25,8 @@
*
* @see io.github.hee9841.excel.annotation.Excel#cellTypeStrategy()
* @see io.github.hee9841.excel.annotation.ExcelColumn#columnCellType()
- * @see ColumnDataType
- * @see io.github.hee9841.excel.meta.ColumnInfoMapper
+ * @see io.github.hee9841.excel.core.meta.ColumnDataType
+ * @see io.github.hee9841.excel.core.meta.ColumnInfoMapper
* @see DataFormatStrategy
*/
public enum CellTypeStrategy {
@@ -36,7 +35,7 @@ public enum CellTypeStrategy {
*
* With this strategy, you can explicitly specify the cell type for each column
* using the {@link io.github.hee9841.excel.annotation.ExcelColumn#columnCellType()} parameter
- * or if not specified, cell type will be {@link ColumnDataType#_NONE}.
+ * or if not specified, cell type will be {@link io.github.hee9841.excel.core.meta.ColumnDataType#_NONE}.
*
*/
NONE,
@@ -50,7 +49,7 @@ public enum CellTypeStrategy {
*
*
* The automatic cell type determination is performed by the
- * {@link io.github.hee9841.excel.meta.ColumnInfoMapper} class.
+ * {@link io.github.hee9841.excel.core.meta.ColumnInfoMapper} class.
* If you want to specify the cell type for a specific column, you can use the
* {@link io.github.hee9841.excel.annotation.ExcelColumn#columnCellType()} parameter.
*
diff --git a/src/main/java/io/github/hee9841/excel/strategy/ColumnIndexStrategy.java b/src/main/java/io/github/hee9841/excel/strategy/ColumnIndexStrategy.java
index d8ccf14..dcfffa7 100644
--- a/src/main/java/io/github/hee9841/excel/strategy/ColumnIndexStrategy.java
+++ b/src/main/java/io/github/hee9841/excel/strategy/ColumnIndexStrategy.java
@@ -22,7 +22,7 @@
*
* @see io.github.hee9841.excel.annotation.Excel#columnIndexStrategy()
* @see io.github.hee9841.excel.annotation.ExcelColumn#columnIndex()
- * @see io.github.hee9841.excel.meta.ColumnInfoMapper
+ * @see io.github.hee9841.excel.core.meta.ColumnInfoMapper
*/
public enum ColumnIndexStrategy {
/**
diff --git a/src/main/java/io/github/hee9841/excel/strategy/DataFormatStrategy.java b/src/main/java/io/github/hee9841/excel/strategy/DataFormatStrategy.java
index a88224d..0eccc0d 100644
--- a/src/main/java/io/github/hee9841/excel/strategy/DataFormatStrategy.java
+++ b/src/main/java/io/github/hee9841/excel/strategy/DataFormatStrategy.java
@@ -1,20 +1,18 @@
package io.github.hee9841.excel.strategy;
-import io.github.hee9841.excel.meta.ColumnDataType;
-
/**
* Strategy enum that determines how data formatting is applied to Excel cells.
*
* This enum defines strategies for controlling how cell formatting patterns are determined and
* applied during
- * Excel export operations. It works in conjunction with the {@link ColumnDataType}
+ * Excel export operations. It works in conjunction with the {@link io.github.hee9841.excel.core.meta.ColumnDataType}
* to apply appropriate formatting to different types of data.
*
* The available strategies are:
*
* - {@code NONE}: No automatic formatting is applied. Formatting must be explicitly specified
* in the {@link io.github.hee9841.excel.annotation.ExcelColumn} annotation.
- * - {@code AUTO_BY_CELL_TYPE}: Automatic formatting is applied based on the {@link ColumnDataType}, but only when the
+ *
- {@code AUTO_BY_CELL_TYPE}: Automatic formatting is applied based on the {@link io.github.hee9841.excel.core.meta.ColumnDataType}, but only when the
* {@link io.github.hee9841.excel.annotation.ExcelColumn#columnCellType()} is explicitly set or determined by the {@link CellTypeStrategy} (not when it's NONE).
* If user specified the {@code format} parameter in the {@link io.github.hee9841.excel.annotation.ExcelColumn} annotation, it will take precedence over the automatic format.
*
@@ -24,7 +22,7 @@
* annotation and affects all columns unless overridden at the column level.
*
* @see io.github.hee9841.excel.annotation.Excel#dataFormatStrategy()
- * @see ColumnDataType
+ * @see io.github.hee9841.excel.core.meta.ColumnDataType
* @see io.github.hee9841.excel.format.ExcelDataFormater
* @see io.github.hee9841.excel.format.CellFormats
*/
@@ -45,7 +43,7 @@ public enum DataFormatStrategy {
*
* This strategy only applies when the cell type is explicitly set (not NONE) or
* determined by the {@link CellTypeStrategy} (when set to AUTO). It uses the format
- * pattern defined for each {@link ColumnDataType} to format
+ * pattern defined for each {@link io.github.hee9841.excel.core.meta.ColumnDataType} to format
* the cell appropriately for its data type.
*
* Note: If a format pattern is explicitly specified in the
diff --git a/src/main/java/io/github/hee9841/excel/strategy/SheetStrategy.java b/src/main/java/io/github/hee9841/excel/strategy/SheetStrategy.java
index 0bfa93a..3c8fa00 100644
--- a/src/main/java/io/github/hee9841/excel/strategy/SheetStrategy.java
+++ b/src/main/java/io/github/hee9841/excel/strategy/SheetStrategy.java
@@ -3,6 +3,7 @@
import static org.apache.commons.compress.archivers.zip.Zip64Mode.Always;
import static org.apache.commons.compress.archivers.zip.Zip64Mode.AsNeeded;
+
import java.util.Objects;
import org.apache.commons.compress.archivers.zip.Zip64Mode;
diff --git a/src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java b/src/test/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporterByteOutputStreamTest.java
similarity index 99%
rename from src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java
rename to src/test/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporterByteOutputStreamTest.java
index e9bcbb0..acc43a9 100644
--- a/src/test/java/io/github/hee9841/excel/core/DefaultExcelExporterByteOutputStreamTest.java
+++ b/src/test/java/io/github/hee9841/excel/core/exporter/DefaultExcelExporterByteOutputStreamTest.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.core;
+package io.github.hee9841.excel.core.exporter;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -12,8 +12,6 @@
import io.github.hee9841.excel.annotation.Excel;
import io.github.hee9841.excel.annotation.ExcelColumn;
import io.github.hee9841.excel.annotation.ExcelColumnStyle;
-import io.github.hee9841.excel.core.exporter.DefaultExcelExporter;
-import io.github.hee9841.excel.core.exporter.SXSSFExporter;
import io.github.hee9841.excel.example.dto.TypeAutoDto;
import io.github.hee9841.excel.example.style.EnumCellStyleExample;
import io.github.hee9841.excel.exception.ExcelException;
diff --git a/src/test/java/io/github/hee9841/excel/meta/CellStyleMappingTest.java b/src/test/java/io/github/hee9841/excel/core/meta/CellStyleMappingTest.java
similarity index 99%
rename from src/test/java/io/github/hee9841/excel/meta/CellStyleMappingTest.java
rename to src/test/java/io/github/hee9841/excel/core/meta/CellStyleMappingTest.java
index 5deeeb5..7d9045b 100644
--- a/src/test/java/io/github/hee9841/excel/meta/CellStyleMappingTest.java
+++ b/src/test/java/io/github/hee9841/excel/core/meta/CellStyleMappingTest.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.meta;
+package io.github.hee9841.excel.core.meta;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
diff --git a/src/test/java/io/github/hee9841/excel/meta/ColumnDataTypeTest.java b/src/test/java/io/github/hee9841/excel/core/meta/ColumnDataTypeTest.java
similarity index 99%
rename from src/test/java/io/github/hee9841/excel/meta/ColumnDataTypeTest.java
rename to src/test/java/io/github/hee9841/excel/core/meta/ColumnDataTypeTest.java
index 2b45d0e..824a34b 100644
--- a/src/test/java/io/github/hee9841/excel/meta/ColumnDataTypeTest.java
+++ b/src/test/java/io/github/hee9841/excel/core/meta/ColumnDataTypeTest.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.meta;
+package io.github.hee9841.excel.core.meta;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.BDDMockito.then;
diff --git a/src/test/java/io/github/hee9841/excel/meta/ColumnInfoMapperTest.java b/src/test/java/io/github/hee9841/excel/core/meta/ColumnInfoMapperTest.java
similarity index 99%
rename from src/test/java/io/github/hee9841/excel/meta/ColumnInfoMapperTest.java
rename to src/test/java/io/github/hee9841/excel/core/meta/ColumnInfoMapperTest.java
index 4e50cea..d39d136 100644
--- a/src/test/java/io/github/hee9841/excel/meta/ColumnInfoMapperTest.java
+++ b/src/test/java/io/github/hee9841/excel/core/meta/ColumnInfoMapperTest.java
@@ -1,4 +1,4 @@
-package io.github.hee9841.excel.meta;
+package io.github.hee9841.excel.core.meta;
import static io.github.hee9841.excel.strategy.ColumnIndexStrategy.USER_DEFINED;
import static org.junit.jupiter.api.Assertions.assertEquals;
diff --git a/src/test/java/io/github/hee9841/excel/example/dto/TypeAutoDto.java b/src/test/java/io/github/hee9841/excel/example/dto/TypeAutoDto.java
index f8bb114..dde43d5 100644
--- a/src/test/java/io/github/hee9841/excel/example/dto/TypeAutoDto.java
+++ b/src/test/java/io/github/hee9841/excel/example/dto/TypeAutoDto.java
@@ -2,7 +2,7 @@
import io.github.hee9841.excel.annotation.Excel;
import io.github.hee9841.excel.annotation.ExcelColumn;
-import io.github.hee9841.excel.meta.ColumnDataType;
+import io.github.hee9841.excel.core.meta.ColumnDataType;
import io.github.hee9841.excel.strategy.CellTypeStrategy;
import io.github.hee9841.excel.strategy.ColumnIndexStrategy;
import java.time.LocalDate;
From aba76619b93f4b13f58184ee8d2e8e7b60f7ca8d Mon Sep 17 00:00:00 2001
From: hee9841
Date: Fri, 12 Sep 2025 11:34:06 +0900
Subject: [PATCH 7/8] =?UTF-8?q?Chore=20:=20gradle=20gradle-8.10=20?=
=?UTF-8?q?=EC=97=90=EC=84=9C=20gradle-8.14=EB=A1=9C=20=EB=B2=84=EC=A0=84?=
=?UTF-8?q?=20up?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
gradle/wrapper/gradle-wrapper.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 9355b41..ca025c8 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
From 8e0a7651dfd0caafec854ec75b14f54fb02be350 Mon Sep 17 00:00:00 2001
From: hee9841
Date: Fri, 12 Sep 2025 11:34:27 +0900
Subject: [PATCH 8/8] =?UTF-8?q?Chore=20:=20java=20=EB=B2=84=EC=A0=84=2021?=
=?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.gradle b/build.gradle
index a4b845b..3cc273b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,7 +19,7 @@ repositories {
java {
toolchain {
- languageVersion = JavaLanguageVersion.of(23)
+ languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar() // 소스 코드도 포함
}