Skip to content

Commit

Permalink
refactoring source code + implement importer
Browse files Browse the repository at this point in the history
  • Loading branch information
phamvanlinh20111993 committed Sep 17, 2023
1 parent 98dc702 commit 96108bd
Show file tree
Hide file tree
Showing 34 changed files with 392 additions and 346 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import org.apache.poi.ss.usermodel.BorderStyle;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import java.awt.Color;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

// TODO implement in the future
public class CellMoreConfig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import org.apache.commons.lang3.builder.ToStringBuilder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import java.awt.Color;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import org.apache.commons.lang3.builder.ToStringBuilder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import org.apache.commons.lang3.builder.ToStringBuilder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import org.apache.commons.lang3.builder.ToStringBuilder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import org.apache.commons.lang3.builder.ToStringBuilder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package excel.exporter.config;
package excel.exporter.datainfo;

import java.util.List;

Expand Down
12 changes: 6 additions & 6 deletions src/excel/exporter/handle/AbstractTableExcelExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import excel.exporter.config.CellBorder;
import excel.exporter.config.CellInfo;
import excel.exporter.config.ColumnInfo;
import excel.exporter.config.HeaderInfo;
import excel.exporter.config.SheetInfo;
import excel.exporter.config.SheetInfoSetting;
import excel.exporter.datainfo.CellBorder;
import excel.exporter.datainfo.CellInfo;
import excel.exporter.datainfo.ColumnInfo;
import excel.exporter.datainfo.HeaderInfo;
import excel.exporter.datainfo.SheetInfo;
import excel.exporter.datainfo.SheetInfoSetting;
import excel.exporter.enums.ExcelType;
import excel.exporter.enums.HeaderNameFormatType;
import utils.ObjectUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.VerticalAlignment;

import excel.exporter.config.SheetInfoSetting;
import excel.exporter.datainfo.SheetInfoSetting;
import excel.exporter.enums.ExcelType;

public class SimpleMultiSheetTableExcelExporter extends AbstractTableExcelExporter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;

import excel.exporter.config.SheetInfoSetting;
import excel.exporter.datainfo.SheetInfoSetting;
import excel.exporter.enums.ExcelType;

public class SimpleSingleSheetTableExcelExporter<T extends Object> extends AbstractTableExcelExporter {
Expand Down
22 changes: 11 additions & 11 deletions src/excel/exporter/handle/TableExcelExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import excel.exporter.annotation.HeaderSetting;
import excel.exporter.annotation.RowSetting;
import excel.exporter.annotation.SheetSetting;
import excel.exporter.config.CellInfo;
import excel.exporter.config.ColumnInfo;
import excel.exporter.config.FontInfo;
import excel.exporter.config.HeaderInfo;
import excel.exporter.config.RowInfo;
import excel.exporter.config.SheetInfo;
import excel.exporter.config.SheetInfoSetting;
import excel.exporter.datainfo.CellInfo;
import excel.exporter.datainfo.ColumnInfo;
import excel.exporter.datainfo.FontInfo;
import excel.exporter.datainfo.HeaderInfo;
import excel.exporter.datainfo.RowInfo;
import excel.exporter.datainfo.SheetInfo;
import excel.exporter.datainfo.SheetInfoSetting;
import utils.Constants;
import utils.ObjectUtils;

Expand Down Expand Up @@ -175,7 +175,7 @@ default SheetInfoSetting toSheetInfo(Object obj) {
if (headerInfos.get(index).getName() == null
|| StringUtils.isAllEmpty(headerInfos.get(index).getName().getValue())) {
HeaderInfo headerInfo = headerInfos.get(index);
excel.exporter.config.HeaderName headerName = new excel.exporter.config.HeaderName();
excel.exporter.datainfo.HeaderName headerName = new excel.exporter.datainfo.HeaderName();
if (field.isAnnotationPresent(HeaderName.class)) {
headerName = toHeaderName(field.getAnnotation(HeaderName.class));
// we don't have any setting, auto get header name is the class property
Expand Down Expand Up @@ -221,9 +221,9 @@ default HeaderInfo toHeaderInfo(HeaderSetting headerSetting) {
* @param headerName
* @return
*/
default excel.exporter.config.HeaderName toHeaderName(HeaderName headerName) {
excel.exporter.config.HeaderName headerNameSetting = (excel.exporter.config.HeaderName) convertAnnotationToConcreteObject(
new excel.exporter.config.HeaderName(), headerName);
default excel.exporter.datainfo.HeaderName toHeaderName(HeaderName headerName) {
excel.exporter.datainfo.HeaderName headerNameSetting = (excel.exporter.datainfo.HeaderName) convertAnnotationToConcreteObject(
new excel.exporter.datainfo.HeaderName(), headerName);
return headerNameSetting;
}

Expand Down
2 changes: 1 addition & 1 deletion src/excel/exporter/main/Example1.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package excel.exporter.main;

import excel.exporter.config.FontInfo;
import excel.exporter.datainfo.FontInfo;
import lombok.Data;

@Data
Expand Down
2 changes: 1 addition & 1 deletion src/excel/exporter/main/Main1.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.lang.reflect.Method;
import java.util.Optional;

import excel.exporter.config.CellInfo;
import excel.exporter.datainfo.CellInfo;
import utils.Constants;
import utils.ObjectUtils;

Expand Down
40 changes: 0 additions & 40 deletions src/excel/importer/SimpleTableExcelImporter.java

This file was deleted.

116 changes: 0 additions & 116 deletions src/excel/importer/TableExcelImporter.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = { ElementType.FIELD })
public @interface MappingHeader {
public @interface MappingField {

String value() default "";

Expand Down
Loading

0 comments on commit 96108bd

Please sign in to comment.