Skip to content

Commit

Permalink
Merge pull request #263 from DatNTHE140692/feature/reopen-for-jdk-11
Browse files Browse the repository at this point in the history
feat: reopen for java 11 and upgrade deps
  • Loading branch information
ozlerhakan committed Dec 24, 2022
2 parents 27db055 + 25420cd commit bd92a12
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
java-version: '11'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Build and Test with Maven
run: mvn clean -B package --file pom.xml -P coverage
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
</issueManagement>

<properties>
<apache.poi.version>5.2.1</apache.poi.version>
<apache.poi.version>5.2.3</apache.poi.version>
<junit.version>4.13.2</junit.version>
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-enforcer-plugin.version>1.2</maven-enforcer-plugin.version>
<jdk.source>17</jdk.source>
<jdk.target>17</jdk.target>
<jdk.source>11</jdk.source>
<jdk.target>11</jdk.target>

<maven.version>3.0.4</maven.version>
</properties>
Expand All @@ -67,7 +67,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/poiji/bind/mapping/SheetUnmarshaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public final class SheetUnmarshaller extends HSSFUnmarshaller {
public <T> void unmarshal(Class<T> type, Consumer<? super T> consumer) {

Workbook workbook = workbook();
if (workbook instanceof HSSFWorkbook hssfWorkbook) {
baseFormulaEvaluator = HSSFFormulaEvaluator.create(hssfWorkbook, null, null);
} else if (workbook instanceof XSSFWorkbook xssfWorkbook) {
baseFormulaEvaluator = XSSFFormulaEvaluator.create(xssfWorkbook, null, null);
if (workbook instanceof HSSFWorkbook) {
baseFormulaEvaluator = HSSFFormulaEvaluator.create((HSSFWorkbook) workbook, null, null);
} else if (workbook instanceof XSSFWorkbook) {
baseFormulaEvaluator = XSSFFormulaEvaluator.create((XSSFWorkbook) workbook, null, null);
} else {
throw new PoijiException("Workbook is not supported.");
}
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/poiji/config/DefaultCasting.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeParseException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
Expand Down Expand Up @@ -207,27 +208,27 @@ private Object castListValue(String value, String sheetName, int row, int col, F
if (fieldType == Integer.class) {
return Stream.of(valueList)
.map(rv -> primitiveIntegerValue(rv, sheetName, row, col))
.toList();
.collect(Collectors.toList());
} else if (fieldType == BigDecimal.class) {
return Stream.of(valueList)
.map(rv -> bigDecimalValue(rv, sheetName, row, col, options))
.toList();
.collect(Collectors.toList());
} else if (fieldType == Long.class) {
return Stream.of(valueList)
.map(rv -> longValue(rv, sheetName, row, col, options))
.toList();
.collect(Collectors.toList());
} else if (fieldType == Double.class) {
return Stream.of(valueList)
.map(rv -> doubleValue(rv, sheetName, row, col, options))
.toList();
.collect(Collectors.toList());
} else if (fieldType == Boolean.class) {
return Stream.of(valueList)
.map(rv -> booleanValue(rv, sheetName, row, col, options))
.toList();
.collect(Collectors.toList());
} else if (fieldType == Float.class) {
return Stream.of(valueList)
.map(rv -> floatValue(rv, sheetName, row, col, options))
.toList();
.collect(Collectors.toList());
} else {
return Arrays.asList(valueList);
}
Expand Down

0 comments on commit bd92a12

Please sign in to comment.