public class BoundedDiagCollector extends java.lang.Object implements DiagCollector
DiagCollector that will contain a bounded amount of Diags. If
more that the max Diag of type Diag.Kind.ERROR are added to the collector, it will
throw an BoundedDiagCollector.TooManyDiagsException. If more than the max for any other type are added to the
collector, it will add a 'too many diags' message and silently ignore additional messages for
that type.| Modifier and Type | Class and Description |
|---|---|
class |
BoundedDiagCollector.TooManyDiagsException
Thrown if more that the max
Diag of type Diag.Kind.ERROR are added to the collector. |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.Integer |
DEFAULT_MAX_ERRORS |
static java.lang.Integer |
DEFAULT_MAX_WARNINGS |
| Constructor and Description |
|---|
BoundedDiagCollector() |
BoundedDiagCollector(java.util.Map<Diag.Kind,java.lang.Integer> capacityByKind) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDiag(Diag diag)
Adds a diagnosis.
|
java.util.List<Diag> |
getDiags()
Returns a collection of diagnostics in the order they were added.
|
int |
getErrorCount()
Returns the number of diagnosed proper errors.
|
java.util.List<Diag> |
getErrors() |
boolean |
hasErrors()
Returns true if there are any diagnosed proper errors; false otherwise.
|
java.lang.String |
toString() |
public static final java.lang.Integer DEFAULT_MAX_ERRORS
public static final java.lang.Integer DEFAULT_MAX_WARNINGS
public BoundedDiagCollector(java.util.Map<Diag.Kind,java.lang.Integer> capacityByKind)
public BoundedDiagCollector()
public void addDiag(Diag diag)
DiagCollectoraddDiag in interface DiagCollectorpublic java.util.List<Diag> getDiags()
DiagCollectorgetDiags in interface DiagCollectorpublic int getErrorCount()
DiagCollectorgetErrorCount in interface DiagCollectorpublic boolean hasErrors()
DiagCollectorhasErrors in interface DiagCollectorpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List<Diag> getErrors()