Package com.tonic.analysis.verifier
Interface ErrorCollector
-
- All Known Implementing Classes:
ErrorCollector.CollectAllCollector,ErrorCollector.FailFastCollector
public interface ErrorCollectorSink for verification errors and warnings, with fail-fast and collect-all (capped) implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classErrorCollector.CollectAllCollectorstatic classErrorCollector.FailFastCollector
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidadd(VerificationError error)Routes an entry toaddError(com.tonic.analysis.verifier.VerificationError)oraddWarning(com.tonic.analysis.verifier.VerificationError)according to its severity.voidaddError(VerificationError error)Records an error.voidaddWarning(VerificationError warning)Records a warning.static ErrorCollectorcollectAll(int maxErrors)Creates a collector that gathers errors up to a cap.static ErrorCollectorfailFast()static ErrorCollectorforConfig(VerifierConfig config)Creates the collector a verifier configuration asks for.List<VerificationError>getErrors()List<VerificationError>getWarnings()booleanhasErrors()booleanhasWarnings()voidreset()Discards every recorded error and warning.booleanshouldStop()
-
-
-
Method Detail
-
addError
void addError(VerificationError error)
Records an error.- Parameters:
error- the error to record
-
addWarning
void addWarning(VerificationError warning)
Records a warning.- Parameters:
warning- the warning to record
-
add
default void add(VerificationError error)
Routes an entry toaddError(com.tonic.analysis.verifier.VerificationError)oraddWarning(com.tonic.analysis.verifier.VerificationError)according to its severity.- Parameters:
error- the entry to record
-
getErrors
List<VerificationError> getErrors()
- Returns:
- the recorded errors
-
getWarnings
List<VerificationError> getWarnings()
- Returns:
- the recorded warnings
-
hasErrors
boolean hasErrors()
- Returns:
- true when at least one error has been recorded
-
hasWarnings
boolean hasWarnings()
- Returns:
- true when at least one warning has been recorded
-
shouldStop
boolean shouldStop()
- Returns:
- true when verification should give up rather than report further errors
-
reset
void reset()
Discards every recorded error and warning.
-
failFast
static ErrorCollector failFast()
- Returns:
- a collector that keeps only the first error and stops verification there
-
collectAll
static ErrorCollector collectAll(int maxErrors)
Creates a collector that gathers errors up to a cap.- Parameters:
maxErrors- the number of errors to retain before stopping- Returns:
- the collector
-
forConfig
static ErrorCollector forConfig(VerifierConfig config)
Creates the collector a verifier configuration asks for.- Parameters:
config- the verifier configuration- Returns:
- a fail-fast collector when the config requests one, otherwise a capped collect-all collector
-
-