Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions fesod/src/main/java/org/apache/fesod/sheet/EasyExcel.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
package org.apache.fesod.sheet;

/**
* This is actually {@link FesodSheetFactory}, and short names look better.
* An alias class for {@link FesodSheet}.
* This class is deprecated; use {@link FesodSheet} instead.
* <p>
* This class will be removed in future versions.
* </p>
*/
@Deprecated
public class EasyExcel extends FesodSheetFactory {}
public class EasyExcel extends FesodSheet {}
9 changes: 6 additions & 3 deletions fesod/src/main/java/org/apache/fesod/sheet/FastExcel.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
package org.apache.fesod.sheet;

/**
* This is actually {@link FastExcelFactory}, and short names look better.
*
* An alias class for {@link FesodSheet}.
* This class is deprecated; use {@link FesodSheet} instead.
* <p>
* This class will be removed in future versions.
* </p>
*/
@Deprecated
public class FastExcel extends FesodSheetFactory {}
public class FastExcel extends FesodSheet {}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
package org.apache.fesod.sheet;

/**
* Reader and writer factory class
* An alias class for {@link FesodSheet}.
* This class is deprecated; use {@link FesodSheet} instead.
* <p>
* This class will be removed in future versions.
* </p>
*/
@Deprecated
public class FastExcelFactory extends FesodSheetFactory {}
public class FastExcelFactory extends FesodSheet {}
312 changes: 310 additions & 2 deletions fesod/src/main/java/org/apache/fesod/sheet/FesodSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,315 @@

package org.apache.fesod.sheet;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.fesod.sheet.read.builder.ExcelReaderBuilder;
import org.apache.fesod.sheet.read.builder.ExcelReaderSheetBuilder;
import org.apache.fesod.sheet.read.listener.ReadListener;
import org.apache.fesod.sheet.write.builder.ExcelWriterBuilder;
import org.apache.fesod.sheet.write.builder.ExcelWriterSheetBuilder;
import org.apache.fesod.sheet.write.builder.ExcelWriterTableBuilder;

/**
* This is actually {@link FesodSheetFactory}, and short names look better.
* Core classes of the Fesod spreadsheet processor
*/
public class FesodSheet extends FesodSheetFactory {}
public class FesodSheet {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove FesodSheetFactory as that's from factory pattern?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure a single core class. In fact, these two types are not much different and they can also avoid some of the checks and prompts in the IDE.


/**
* Build excel the write
*
* @return
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing @return description in JavaDoc. The @return tag should include a description of what is returned (e.g., "Excel writer builder").

Suggested change
* @return
* @return Excel writer builder

Copilot uses AI. Check for mistakes.
*/
public static ExcelWriterBuilder write() {
return new ExcelWriterBuilder();
}

/**
* Build excel the write
*
* @param file File to write
* @return Excel writer builder
*/
public static ExcelWriterBuilder write(File file) {
return write(file, null);
}

/**
* Build excel the write
*
* @param file File to write
* @param head Annotate the class for configuration information
* @return Excel writer builder
*/
public static ExcelWriterBuilder write(File file, Class head) {
return new ExcelWriterBuilder().file(file).headIfNotNull(head);
}

/**
* Build excel the write
*
* @param pathName File path to write
* @return Excel writer builder
*/
public static ExcelWriterBuilder write(String pathName) {
return write(pathName, null);
}

/**
* Build excel the write
*
* @param pathName File path to write
* @param head Annotate the class for configuration information
* @return Excel writer builder
*/
public static ExcelWriterBuilder write(String pathName, Class head) {
return new ExcelWriterBuilder().file(pathName).headIfNotNull(head);
}

/**
* Build excel the write
*
* @param outputStream Output stream to write
* @return Excel writer builder
*/
public static ExcelWriterBuilder write(OutputStream outputStream) {
return write(outputStream, null);
}

/**
* Build excel the write
*
* @param outputStream Output stream to write
* @param head Annotate the class for configuration information.
* @return Excel writer builder
*/
public static ExcelWriterBuilder write(OutputStream outputStream, Class head) {
return new ExcelWriterBuilder().file(outputStream).headIfNotNull(head);
}

/**
* Build excel the <code>writerSheet</code>
*
* @return Excel sheet writer builder
*/
public static ExcelWriterSheetBuilder writerSheet() {
return writerSheet(null, null);
}

/**
* Build excel the <code>writerSheet</code>
*
* @param sheetNo Index of sheet,0 base.
* @return Excel sheet writer builder.
*/
public static ExcelWriterSheetBuilder writerSheet(Integer sheetNo) {
return writerSheet(sheetNo, null);
}

/**
* Build excel the 'writerSheet'
*
* @param sheetName The name of sheet.
* @return Excel sheet writer builder.
*/
public static ExcelWriterSheetBuilder writerSheet(String sheetName) {
return writerSheet(null, sheetName);
}

/**
* Build excel the 'writerSheet'
*
* @param sheetNo Index of sheet,0 base.
* @param sheetName The name of sheet.
* @return Excel sheet writer builder.
*/
public static ExcelWriterSheetBuilder writerSheet(Integer sheetNo, String sheetName) {
return new ExcelWriterSheetBuilder().sheetNoIfNotNull(sheetNo).sheetNameIfNotNull(sheetName);
}

/**
* Build excel the <code>writerTable</code>
*
* @return Excel table writer builder.
*/
public static ExcelWriterTableBuilder writerTable() {
return writerTable(null);
}

/**
* Build excel the 'writerTable'
*
* @param tableNo Index of table,0 base.
* @return Excel table writer builder.
*/
public static ExcelWriterTableBuilder writerTable(Integer tableNo) {
return new ExcelWriterTableBuilder().tableNoIfNotNull(tableNo);
}

/**
* Build excel the read
*
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read() {
return new ExcelReaderBuilder();
}

/**
* Build excel the read
*
* @param file File to read.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(File file) {
return read(file, null, null);
}

/**
* Build excel the read
*
* @param file File to read.
* @param readListener Read listener.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(File file, ReadListener readListener) {
return read(file, null, readListener);
}

/**
* Build excel the read
*
* @param file File to read.
* @param head Annotate the class for configuration information.
* @param readListener Read listener.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(File file, Class head, ReadListener readListener) {
return new ExcelReaderBuilder().file(file).headIfNotNull(head).registerReadListenerIfNotNull(readListener);
}

/**
* Build excel the read
*
* @param pathName File path to read.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(String pathName) {
return read(pathName, null, null);
}

/**
* Build excel the read
*
* @param pathName File path to read.
* @param readListener Read listener.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(String pathName, ReadListener readListener) {
return read(pathName, null, readListener);
}

/**
* Build excel the read
*
* @param pathName File path to read.
* @param head Annotate the class for configuration information.
* @param readListener Read listener.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(String pathName, Class head, ReadListener readListener) {
return new ExcelReaderBuilder().file(pathName).headIfNotNull(head).registerReadListenerIfNotNull(readListener);
}

/**
* Build excel the read
*
* @param inputStream Input stream to read.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(InputStream inputStream) {
return read(inputStream, null, null);
}

/**
* Build excel the read
*
* @param inputStream Input stream to read.
* @param readListener Read listener.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(InputStream inputStream, ReadListener readListener) {
return read(inputStream, null, readListener);
}

/**
* Build excel the read
*
* @param inputStream Input stream to read.
* @param head Annotate the class for configuration information.
* @param readListener Read listener.
* @return Excel reader builder.
*/
public static ExcelReaderBuilder read(InputStream inputStream, Class head, ReadListener readListener) {
return new ExcelReaderBuilder()
.file(inputStream)
.headIfNotNull(head)
.registerReadListenerIfNotNull(readListener);
}

/**
* Build excel the 'readSheet'
*
* @return Excel sheet reader builder.
*/
public static ExcelReaderSheetBuilder readSheet() {
return readSheet(null, null);
}

/**
* Build excel the 'readSheet'
*
* @param sheetNo Index of sheet,0 base.
* @return Excel sheet reader builder.
*/
public static ExcelReaderSheetBuilder readSheet(Integer sheetNo) {
return readSheet(sheetNo, null);
}

/**
* Build excel the 'readSheet'
*
* @param sheetName The name of sheet.
* @return Excel sheet reader builder.
*/
public static ExcelReaderSheetBuilder readSheet(String sheetName) {
return readSheet(null, sheetName);
}

/**
* Build excel the 'readSheet'
*
* @param sheetNo Index of sheet,0 base.
* @param sheetName The name of sheet.
* @return Excel sheet reader builder.
*/
public static ExcelReaderSheetBuilder readSheet(Integer sheetNo, String sheetName) {
return readSheet(sheetNo, sheetName, null);
}

/**
* Build excel the 'readSheet'
*
* @param sheetNo Index of sheet,0 base.
* @param sheetName The name of sheet.
* @param numRows The number of rows to read, the default is all, start with 0.
* @return
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing @return description in JavaDoc. The @return tag should include a description of what is returned (e.g., "Excel sheet reader builder").

Suggested change
* @return
* @return Excel sheet reader builder.

Copilot uses AI. Check for mistakes.
*/
public static ExcelReaderSheetBuilder readSheet(Integer sheetNo, String sheetName, Integer numRows) {
return new ExcelReaderSheetBuilder()
.sheetNoIfNotNull(sheetNo)
.sheetNameIfNotNull(sheetName)
.numRowsIfNotNull(numRows);
}
}
Loading
Loading