Class MessageStripExceptions<M extends Message>

java.lang.Object
eu.bandm.tools.message.SingleSender<M>
eu.bandm.tools.message.MessageStripExceptions<M>
All Implemented Interfaces:
MessageReceiver<M>

public class MessageStripExceptions<M extends Message> extends SingleSender<M> implements MessageReceiver<M>
A filter which strips off all exceptions, or at least the stack traces, for a slimmer appearance of print-outs.
  • Field Details

    • total

      protected boolean total
      Whether exceptions are stripped off totally. If false: only their stack trace.
    • emptyStackTrace

      protected static final StackTraceElement[] emptyStackTrace
  • Constructor Details

    • MessageStripExceptions

      public MessageStripExceptions(MessageReceiver<? super M> d, boolean total)
      Only constructor.
      Parameters:
      total - whether exceptions are stripped off totally, or only their stack trace.
  • Method Details

    • receive

      public void receive(M m)
      Pass on the message after removing the exception (total=true) or replacing it with a clone without stack trace. Please note that the Message object and the Exception object are altered, which may affect parallel references.
      Specified by:
      receive in interface MessageReceiver<M extends Message>