Package com.tonic.renamer.validation
Class ValidationResult
- java.lang.Object
-
- com.tonic.renamer.validation.ValidationResult
-
public class ValidationResult extends Object
Contains the results of validating rename mappings.
-
-
Constructor Summary
Constructors Constructor Description ValidationResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(String message)Records an error, which makes the result invalid.voidaddWarning(String message)Records a warning, which leaves the result valid.intgetErrorCount()List<String>getErrors()StringgetReport()Renders every error and warning as an indented, sectioned listing.intgetWarningCount()List<String>getWarnings()booleanhasErrors()booleanhasWarnings()booleanisValid()voidmerge(ValidationResult other)Appends another result's errors and warnings to this one.StringtoString()
-
-
-
Method Detail
-
addError
public void addError(String message)
Records an error, which makes the result invalid.- Parameters:
message- error text
-
addWarning
public void addWarning(String message)
Records a warning, which leaves the result valid.- Parameters:
message- warning text
-
isValid
public boolean isValid()
- Returns:
- true if no error was recorded
-
hasErrors
public boolean hasErrors()
- Returns:
- true if at least one error was recorded
-
hasWarnings
public boolean hasWarnings()
- Returns:
- true if at least one warning was recorded
-
getErrorCount
public int getErrorCount()
- Returns:
- the number of recorded errors
-
getWarningCount
public int getWarningCount()
- Returns:
- the number of recorded warnings
-
merge
public void merge(ValidationResult other)
Appends another result's errors and warnings to this one.- Parameters:
other- result to absorb
-
getReport
public String getReport()
Renders every error and warning as an indented, sectioned listing.- Returns:
- the report, or a "no errors or warnings" line when both lists are empty
-
-