Class HoldReporter

  • All Implemented Interfaces:
    Reporter

    public class HoldReporter
    extends java.lang.Object
    implements Reporter
    Reporter implementation that records reports, and can dump them on request to another Reporter instance.

    Not thread-safe.

    Since:
    24 May 2016
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      HoldReporter()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dumpReports​(Reporter reporter)
      Dumps all reports received to date to a supplied reporter.
      void report​(ReportCode code, java.lang.String msg)
      Reports a message.
      void report​(ReportCode code, java.lang.String msg, java.lang.Throwable err)
      Reports a message with an associated throwable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HoldReporter

        public HoldReporter()
        Constructor.
    • Method Detail

      • report

        public void report​(ReportCode code,
                           java.lang.String msg)
        Description copied from interface: Reporter
        Reports a message.

        This convenience method is equivalent to calling report(code,message,null)

        Specified by:
        report in interface Reporter
        Parameters:
        code - report code; messages with the same code should identify essentially the same condition
        msg - free-text message; it may be multi-line and/or longish, but may in practice be truncated on output
      • report

        public void report​(ReportCode code,
                           java.lang.String msg,
                           java.lang.Throwable err)
        Description copied from interface: Reporter
        Reports a message with an associated throwable.
        Specified by:
        report in interface Reporter
        Parameters:
        code - report code; messages with the same code should identify essentially the same condition
        msg - free-text message; it may be multi-line and/or longish, but may in practice be truncated on output
        err - throwable
      • dumpReports

        public void dumpReports​(Reporter reporter)
        Dumps all reports received to date to a supplied reporter. Reports are passed on in order of receipt. The list of held reports is emptied by calling this method.
        Parameters:
        reporter - destination reporter