-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,695 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/poiji/bind/mapping/HSSFReadMappedFields.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.poiji.bind.mapping; | ||
|
||
import com.poiji.option.PoijiOptions; | ||
import org.apache.poi.ss.usermodel.DataFormatter; | ||
import org.apache.poi.ss.usermodel.Row; | ||
|
||
public final class HSSFReadMappedFields extends ReadMappedFields{ | ||
|
||
private final DataFormatter dataFormatter; | ||
|
||
public HSSFReadMappedFields(final Class<?> entity, final PoijiOptions options) { | ||
super(entity, options); | ||
dataFormatter = new DataFormatter(); | ||
} | ||
|
||
@Override | ||
public HSSFReadMappedFields parseEntity(){ | ||
super.parseEntity(); | ||
return this; | ||
} | ||
|
||
public <T> T parseRow(final Row row, final T instance) { | ||
setRowInInstance(row, instance); | ||
return instance; | ||
} | ||
|
||
private <T> void setRowInInstance(final Row row, final T instance) { | ||
for (short columnOrder = row.getFirstCellNum(); columnOrder < row.getLastCellNum(); columnOrder++) { | ||
setCellInInstance(row.getRowNum(), columnOrder, dataFormatter.formatCellValue(row.getCell(columnOrder)), instance); | ||
} | ||
} | ||
|
||
public void parseColumnNames(final Row row) { | ||
for (short columnOrder = row.getFirstCellNum(); columnOrder < row.getLastCellNum(); columnOrder++) { | ||
parseColumnName(columnOrder, row.getCell(columnOrder).getStringCellValue()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.