teragrep / cfe_31

0 stars 0 forks source link

Change validate methods to not have any params #44

Closed MoonBow-1 closed 5 months ago

MoonBow-1 commented 5 months ago

Description

Validate methods should validate self, and not be dependent on outside parameters

MoonBow-1 commented 5 months ago

Example of old isValid/validate method:

public boolean isValid(final Configuration configuration) {
         boolean valid = true;
         final FaultyReport faultyReport = new FaultyReport();
         ...

         try {
             faultyReport.writeFaultyRecords(configuration.faultyReportFile);
         ...

Refactored version:

class Example {
     final FaultyReportFile faultyReportFile;
     ...
     public boolean validate() {
         boolean valid = true;
         final FaultyReport faultyReport = new FaultyReport();
         ... 

         try {
             faultyReport.writeFaultyRecords(faultyReportFile); 
         ...
}