Class AccumulatingMessageHandler
java.lang.Object
com.github.oowekyala.ooxml.messages.AccumulatingMessageHandler
- All Implemented Interfaces:
XmlMessageHandler, AutoCloseable
public abstract class AccumulatingMessageHandler
extends Object
implements XmlMessageHandler, AutoCloseable
Accumulates messages and does not display them until the
reporter is closed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final XmlMessageHandlerprivate final EnumMap<XmlSeverity, Map<String, List<XmlException>>> protected final XmlSeverityFields inherited from interface XmlMessageHandler
NOOP, SYSTEM_ERR -
Constructor Summary
ConstructorsConstructorDescriptionAccumulatingMessageHandler(XmlMessageHandler basePrinter, XmlSeverity minSeverity) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(XmlException ex) Handle an XML message.voidclose()voidclose(XmlSeverity minSeverityToPrintSummary, XmlSeverity minSeverityToPrintFully) Close the reporter and print the accumulated exceptions.protected voiddontPrint(XmlSeverity severity, Map<String, List<XmlException>> entriesByMessage) Handle ignored messages.protected voidprintFully(XmlSeverity severity, String message, List<XmlException> entry) Print "fully", the default prints all entries.protected voidprintSummary(XmlSeverity severity, String message, List<XmlException> entry) Print a summary line, not every one of the entries.protected abstract voidprintSummaryLine(String kind, XmlSeverity severity, String message)
-
Field Details
-
entries
-
minSeverity
-
basePrinter
-
-
Constructor Details
-
AccumulatingMessageHandler
-
-
Method Details
-
accept
Description copied from interface:XmlMessageHandlerHandle an XML message. May throw, ignore, or print to an external stream.- Specified by:
acceptin interfaceXmlMessageHandler- Parameters:
ex- Message to handle
-
printSummaryLine
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
close
Close the reporter and print the accumulated exceptions. The two parameters select how entries are printed to thebasePrinter, they are dispatched to the methodsdontPrint(XmlSeverity, Map),printFully(XmlSeverity, String, List)andprintSummary(XmlSeverity, String, List). -
printFully
Print "fully", the default prints all entries. This is so that previous errors are not forgotten.- Parameters:
severity- severity of the messagemessage- Message with which the entry was reportedentry- A nonempty list
-
printSummary
Print a summary line, not every one of the entries.- Parameters:
severity- severity of the messagemessage- Message with which the entry was reportedentry- A nonempty list
-
dontPrint
Handle ignored messages.- Parameters:
severity- SeverityentriesByMessage- Entries for the given severity, indexed by their message
-