diff --git a/easyexcel-core/pom.xml b/easyexcel-core/pom.xml index 06724d97..a42a36b9 100644 --- a/easyexcel-core/pom.xml +++ b/easyexcel-core/pom.xml @@ -15,6 +15,10 @@ + + com.alibaba + easyexcel-support + org.apache.poi poi diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java index 839a8b4b..a83f64a5 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java @@ -1,103 +1,3 @@ -package com.alibaba.excel.metadata; - -import java.util.List; -import java.util.Map; - -import com.alibaba.excel.converters.Converter; -import com.alibaba.excel.converters.ConverterKeyBuild.ConverterKey; - -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - /** - * Write/read holder - * - * @author Jiaju Zhuang + * Documents have been migrated to https://github.com/alibaba/easyexcel/blob/master/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/demo/fill/FillTest.java */ -@Getter -@Setter -@EqualsAndHashCode -@NoArgsConstructor -public abstract class AbstractHolder implements ConfigurationHolder { - /** - * Record whether it's new or from cache - */ - private Boolean newInitialization; - /** - * You can only choose one of the {@link AbstractHolder#head} and {@link AbstractHolder#clazz} - */ - private List> head; - /** - * You can only choose one of the {@link AbstractHolder#head} and {@link AbstractHolder#clazz} - */ - private Class clazz; - /** - * Some global variables - */ - private GlobalConfiguration globalConfiguration; - /** - *

- * Read key: - *

- * Write key: - */ - private Map> converterMap; - - public AbstractHolder(BasicParameter basicParameter, AbstractHolder prentAbstractHolder) { - this.newInitialization = Boolean.TRUE; - if (basicParameter.getHead() == null && basicParameter.getClazz() == null && prentAbstractHolder != null) { - this.head = prentAbstractHolder.getHead(); - } else { - this.head = basicParameter.getHead(); - } - if (basicParameter.getHead() == null && basicParameter.getClazz() == null && prentAbstractHolder != null) { - this.clazz = prentAbstractHolder.getClazz(); - } else { - this.clazz = basicParameter.getClazz(); - } - this.globalConfiguration = new GlobalConfiguration(); - if (basicParameter.getAutoTrim() == null) { - if (prentAbstractHolder != null) { - globalConfiguration.setAutoTrim(prentAbstractHolder.getGlobalConfiguration().getAutoTrim()); - } - } else { - globalConfiguration.setAutoTrim(basicParameter.getAutoTrim()); - } - - if (basicParameter.getUse1904windowing() == null) { - if (prentAbstractHolder != null) { - globalConfiguration.setUse1904windowing( - prentAbstractHolder.getGlobalConfiguration().getUse1904windowing()); - } - } else { - globalConfiguration.setUse1904windowing(basicParameter.getUse1904windowing()); - } - - if (basicParameter.getLocale() == null) { - if (prentAbstractHolder != null) { - globalConfiguration.setLocale(prentAbstractHolder.getGlobalConfiguration().getLocale()); - } - } else { - globalConfiguration.setLocale(basicParameter.getLocale()); - } - - } - - @Override - public Map> converterMap() { - return getConverterMap(); - } - - @Override - public GlobalConfiguration globalConfiguration() { - return getGlobalConfiguration(); - } - - @Override - public boolean isNew() { - return getNewInitialization(); - } - -} diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java b/easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java index eab4a70f..b089612b 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java @@ -1,8 +1,7 @@ package com.alibaba.excel.util; -import net.sf.cglib.beans.BeanMap; -import net.sf.cglib.beans.BeanMap.Generator; -import net.sf.cglib.core.DefaultNamingPolicy; +import org.springframework.cglib.beans.BeanMap; +import org.springframework.cglib.core.DefaultNamingPolicy; /** * bean utils @@ -23,9 +22,10 @@ public class BeanMapUtils { * @return a new BeanMap instance */ public static BeanMap create(Object bean) { - Generator gen = new Generator(); - gen.setBean(bean); - gen.setNamingPolicy(EasyExcelNamingPolicy.INSTANCE); + BeanMap.Generator gen = new BeanMap.Generator(); + //gen.setBean(student); + //gen.setContextClass(Student.class); + BeanMap beanMap = gen.create(); return gen.create(); } diff --git a/easyexcel-support/pom.xml b/easyexcel-support/pom.xml index 6864f447..c689359a 100644 --- a/easyexcel-support/pom.xml +++ b/easyexcel-support/pom.xml @@ -34,9 +34,19 @@ shade + true + false + true + + true + + + org.springframework:spring-core + + - cglib:cglib + org.springframework:spring-core org/springframework/asm/** org/springframework/cglib/** @@ -53,6 +63,10 @@ + + org.codehaus.mojo + flatten-maven-plugin + diff --git a/easyexcel-support/src/main/java/com/alibaba/excel/support/package-info.java b/easyexcel-support/src/main/java/com/alibaba/excel/support/package-info.java new file mode 100644 index 00000000..35190378 --- /dev/null +++ b/easyexcel-support/src/main/java/com/alibaba/excel/support/package-info.java @@ -0,0 +1,4 @@ +/** + * + */ +package com.alibaba.excel.support; diff --git a/easyexcel/pom.xml b/easyexcel/pom.xml new file mode 100644 index 00000000..5d28b0d0 --- /dev/null +++ b/easyexcel/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + + com.alibaba + easyexcel-parent + ${revision} + ../pom.xml + + + easyexcel + + + + com.alibaba + easyexcel-core + + + + diff --git a/easyexcel/src/main/java/com/alibaba/excel/package-info.java b/easyexcel/src/main/java/com/alibaba/excel/package-info.java new file mode 100644 index 00000000..7b3933ee --- /dev/null +++ b/easyexcel/src/main/java/com/alibaba/excel/package-info.java @@ -0,0 +1,4 @@ +/** + * + */ +package com.alibaba.excel; diff --git a/pom.xml b/pom.xml index ca60992a..b6d002d0 100644 --- a/pom.xml +++ b/pom.xml @@ -14,6 +14,7 @@ easyexcel-core easyexcel-support + easyexcel @@ -67,6 +68,24 @@ + + com.alibaba + easyexcel + ${revision} + + + + com.alibaba + easyexcel-core + ${revision} + + + + com.alibaba + easyexcel-support + ${revision} + + org.apache.poi poi @@ -347,12 +366,12 @@ flatten-maven-plugin true - oss + resolveCiFriendliesOnly flatten - process-resources + package flatten diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/fill/FillTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/fill/FillTest.java new file mode 100644 index 00000000..a83f64a5 --- /dev/null +++ b/src/test/java/com/alibaba/easyexcel/test/demo/fill/FillTest.java @@ -0,0 +1,3 @@ +/** + * Documents have been migrated to https://github.com/alibaba/easyexcel/blob/master/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/demo/fill/FillTest.java + */ diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java new file mode 100644 index 00000000..5c7e8068 --- /dev/null +++ b/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java @@ -0,0 +1,3 @@ +/** + * Documents have been migrated to https://github.com/alibaba/easyexcel/blob/master/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java + */ diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java new file mode 100644 index 00000000..3c234d83 --- /dev/null +++ b/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java @@ -0,0 +1,3 @@ +/** + * Documents have been migrated to https://github.com/alibaba/easyexcel/blob/master/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java + */ diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java new file mode 100644 index 00000000..340d228f --- /dev/null +++ b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java @@ -0,0 +1,3 @@ +/** + * Documents have been migrated to https://github.com/alibaba/easyexcel/blob/master/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java + */