Adds simple Javadoc

This commit is contained in:
Julien Lengrand-Lambert
2020-05-25 22:45:32 +02:00
parent 60044c8f9a
commit 9f9b409b56
5 changed files with 29 additions and 0 deletions

View File

@@ -7,6 +7,10 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* This class extends from the template report creator, only implementing the logic to read a binary file
* as input for a report
*/
public class BinReportCreator extends ReportCreator{
@Override

View File

@@ -6,6 +6,11 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* This file was just created to created the binary report that will be later read.
* It is not part of the template method pattern
*/
public class BinaryFileMaker {
public static void main(String[] args) throws IOException {

View File

@@ -8,6 +8,10 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* This class extends from the template report creator, only implementing the logic to read a csv file
* as input for a report
*/
public class CsvReportCreator extends ReportCreator {
@Override

View File

@@ -3,6 +3,16 @@ package nl.lengrand.patterns.template;
import java.io.File;
import java.io.IOException;
/**
* This class is here to demonstrate how to use the template method pattern.
* Below, we are creating reports from a csv and a binary file.
* Only a small part of the implementation is available to us, which allows to hide the complexity in a neat way.
*
* There is some boilerplate needed to find the files in the resource folder, but you can ignore that part
*
* The file being used to generate reports are in the resource folder, named template.csv and template.bin
*/
public class ReportCreation {
public static void main(String[] args) throws IOException {
ReportCreation reportCreation = new ReportCreation();

View File

@@ -6,6 +6,12 @@ import java.util.InputMismatchException;
import java.util.List;
import java.util.stream.Collectors;
/**
* ReportCreator is our abstract template. It contains most of the boilerplate on how to create reports.
* Most of the logic should be hidden from the end user (and the implementors). We need each type of report to extend
* from ReportCreator so we can know how to read the input files
*/
public abstract class ReportCreator {
final void createReport(File filePath) throws IOException {