polish
inline numberOfRows, numberOfColumns and the name for performance.
This commit is contained in:
committed by
Michael Minella
parent
01ae4985e4
commit
58bbaa494d
@@ -31,6 +31,9 @@ import org.springframework.batch.item.excel.Sheet;
|
||||
public class JxlSheet implements Sheet {
|
||||
|
||||
private final jxl.Sheet delegate;
|
||||
private final int numberOfRows;
|
||||
private final int numberOfColumns;
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Constructor which takes the delegate sheet.
|
||||
@@ -40,6 +43,9 @@ public class JxlSheet implements Sheet {
|
||||
JxlSheet(final jxl.Sheet delegate) {
|
||||
super();
|
||||
this.delegate = delegate;
|
||||
this.numberOfRows = this.delegate.getRows();
|
||||
this.numberOfColumns = this.delegate.getNumberOfImages();
|
||||
this.name=this.delegate.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +53,7 @@ public class JxlSheet implements Sheet {
|
||||
*/
|
||||
@Override
|
||||
public int getNumberOfRows() {
|
||||
return this.delegate.getRows();
|
||||
return this.numberOfRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +74,7 @@ public class JxlSheet implements Sheet {
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.delegate.getName();
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +82,7 @@ public class JxlSheet implements Sheet {
|
||||
*/
|
||||
@Override
|
||||
public int getNumberOfColumns() {
|
||||
return this.delegate.getColumns();
|
||||
return this.numberOfColumns;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ import java.util.List;
|
||||
public class PoiSheet implements Sheet {
|
||||
|
||||
private final org.apache.poi.ss.usermodel.Sheet delegate;
|
||||
private final int numberOfRows;
|
||||
private final String name;
|
||||
|
||||
private int numberOfColumns = -1;
|
||||
|
||||
@@ -44,6 +46,8 @@ public class PoiSheet implements Sheet {
|
||||
PoiSheet(final org.apache.poi.ss.usermodel.Sheet delegate) {
|
||||
super();
|
||||
this.delegate = delegate;
|
||||
this.numberOfRows = this.delegate.getLastRowNum() + 1;
|
||||
this.name=this.delegate.getSheetName();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +55,7 @@ public class PoiSheet implements Sheet {
|
||||
*/
|
||||
@Override
|
||||
public int getNumberOfRows() {
|
||||
return this.delegate.getLastRowNum() + 1;
|
||||
return this.numberOfRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +63,7 @@ public class PoiSheet implements Sheet {
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.delegate.getSheetName();
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user