Browse Source

修改目录结构

pull/2317/head
Jiaju Zhuang 3 years ago
parent
commit
1372952139
  1. 4
      easyexcel-core/pom.xml
  2. 102
      easyexcel-core/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java
  3. 12
      easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java
  4. 16
      easyexcel-support/pom.xml
  5. 4
      easyexcel-support/src/main/java/com/alibaba/excel/support/package-info.java
  6. 23
      easyexcel/pom.xml
  7. 4
      easyexcel/src/main/java/com/alibaba/excel/package-info.java
  8. 23
      pom.xml
  9. 3
      src/test/java/com/alibaba/easyexcel/test/demo/fill/FillTest.java
  10. 3
      src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java
  11. 3
      src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java
  12. 3
      src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java

4
easyexcel-core/pom.xml

@ -15,6 +15,10 @@
<dependencies> <dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-support</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>

102
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 * 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
*
* @author Jiaju Zhuang
*/ */
@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<List<String>> head;
/**
* You can only choose one of the {@link AbstractHolder#head} and {@link AbstractHolder#clazz}
*/
private Class<?> clazz;
/**
* Some global variables
*/
private GlobalConfiguration globalConfiguration;
/**
* <p>
* Read key:
* <p>
* Write key:
*/
private Map<ConverterKey, Converter<?>> 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<ConverterKey, Converter<?>> converterMap() {
return getConverterMap();
}
@Override
public GlobalConfiguration globalConfiguration() {
return getGlobalConfiguration();
}
@Override
public boolean isNew() {
return getNewInitialization();
}
}

12
easyexcel-core/src/main/java/com/alibaba/excel/util/BeanMapUtils.java

@ -1,8 +1,7 @@
package com.alibaba.excel.util; package com.alibaba.excel.util;
import net.sf.cglib.beans.BeanMap; import org.springframework.cglib.beans.BeanMap;
import net.sf.cglib.beans.BeanMap.Generator; import org.springframework.cglib.core.DefaultNamingPolicy;
import net.sf.cglib.core.DefaultNamingPolicy;
/** /**
* bean utils * bean utils
@ -23,9 +22,10 @@ public class BeanMapUtils {
* @return a new <code>BeanMap</code> instance * @return a new <code>BeanMap</code> instance
*/ */
public static BeanMap create(Object bean) { public static BeanMap create(Object bean) {
Generator gen = new Generator(); BeanMap.Generator gen = new BeanMap.Generator();
gen.setBean(bean); //gen.setBean(student);
gen.setNamingPolicy(EasyExcelNamingPolicy.INSTANCE); //gen.setContextClass(Student.class);
BeanMap beanMap = gen.create();
return gen.create(); return gen.create();
} }

16
easyexcel-support/pom.xml

@ -34,9 +34,19 @@
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
<createSourcesJar>true</createSourcesJar>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>true</createDependencyReducedPom>
<!-- Make sure the transitive dependencies are written to the generated pom under <dependencies> -->
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<artifactSet>
<includes>
<include>org.springframework:spring-core</include>
</includes>
</artifactSet>
<filters> <filters>
<filter> <filter>
<artifact>cglib:cglib</artifact> <artifact>org.springframework:spring-core</artifact>
<includes> <includes>
<include>org/springframework/asm/**</include> <include>org/springframework/asm/**</include>
<include>org/springframework/cglib/**</include> <include>org/springframework/cglib/**</include>
@ -53,6 +63,10 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

4
easyexcel-support/src/main/java/com/alibaba/excel/support/package-info.java

@ -0,0 +1,4 @@
/**
*
*/
package com.alibaba.excel.support;

23
easyexcel/pom.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-parent</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>easyexcel</artifactId>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId>
</dependency>
</dependencies>
</project>

4
easyexcel/src/main/java/com/alibaba/excel/package-info.java

@ -0,0 +1,4 @@
/**
*
*/
package com.alibaba.excel;

23
pom.xml

@ -14,6 +14,7 @@
<modules> <modules>
<module>easyexcel-core</module> <module>easyexcel-core</module>
<module>easyexcel-support</module> <module>easyexcel-support</module>
<module>easyexcel</module>
</modules> </modules>
@ -67,6 +68,24 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-support</artifactId>
<version>${revision}</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
@ -347,12 +366,12 @@
<artifactId>flatten-maven-plugin</artifactId> <artifactId>flatten-maven-plugin</artifactId>
<configuration> <configuration>
<updatePomFile>true</updatePomFile> <updatePomFile>true</updatePomFile>
<flattenMode>oss</flattenMode> <flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>flatten</id> <id>flatten</id>
<phase>process-resources</phase> <phase>package</phase>
<goals> <goals>
<goal>flatten</goal> <goal>flatten</goal>
</goals> </goals>

3
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
*/

3
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
*/

3
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
*/

3
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
*/
Loading…
Cancel
Save