Skip to content

Commit de80894

Browse files
javier-godoypaodb
authored andcommitted
refactor: make template private
1 parent ad66b62 commit de80894

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/main/java/com/flowingcode/vaadin/addons/gridexporter/BaseStreamResourceWriter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ abstract class BaseStreamResourceWriter<T> implements StreamResourceWriter {
4949
private static final Logger LOGGER = LoggerFactory.getLogger(BaseStreamResourceWriter.class);
5050

5151
protected GridExporter<T> exporter;
52-
protected String template;
52+
private String template;
5353

5454
public BaseStreamResourceWriter(GridExporter<T> exporter) {
5555
super();
@@ -63,6 +63,10 @@ public BaseStreamResourceWriter(
6363
template = customTemplate == null ? defaultTemplate : customTemplate;
6464
}
6565

66+
protected String getTemplate() {
67+
return template;
68+
}
69+
6670
/**
6771
* If a column was configured to be exported or not, that will be honored. If not, it will
6872
* exported based on the visibility

src/main/java/com/flowingcode/vaadin/addons/gridexporter/DocxStreamResourceWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ private XWPFTable findTable(XWPFDocument doc) {
361361
}
362362

363363
private XWPFDocument getBaseTemplateDoc() throws EncryptedDocumentException, IOException {
364-
InputStream inp = this.getClass().getResourceAsStream(template);
364+
InputStream inp = this.getClass().getResourceAsStream(getTemplate());
365365
return new XWPFDocument(inp);
366366
}
367367
}

src/main/java/com/flowingcode/vaadin/addons/gridexporter/ExcelStreamResourceWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ private void applyExcelFormat(Cell cell, String excelFormat, Map<String, CellSty
391391

392392
private Workbook getBaseTemplateWorkbook() {
393393
try {
394-
InputStream inp = this.getClass().getResourceAsStream(template);
394+
InputStream inp = this.getClass().getResourceAsStream(getTemplate());
395395
Workbook result = WorkbookFactory.create(inp);
396396
return result;
397397
} catch (Exception e) {

0 commit comments

Comments
 (0)