Class DefaultFlowMessageFactory.AbstractFlowMessage

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void formatTo​(java.lang.StringBuilder buffer)
      Writes a text representation of this object into the specified StringBuilder, ideally without allocating temporary objects.
      java.lang.String getFormat()
      This method has unclear semantics and inconsistent implementations – its usage is strongly discouraged.
      java.lang.String getFormattedMessage()
      Gets the Message formatted as a String.
      Message getMessage()
      The wrapped message
      java.lang.Object[] getParameters()
      Gets parameter values, if any.
      java.lang.String getText()
      The message text like "Enter" or "Exit" used to prefix the actual Message.
      java.lang.Throwable getThrowable()
      Gets the throwable, if any.
      • Methods inherited from class java.lang.Object

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

      • message

        private final Message message
      • text

        private final java.lang.String text
    • Constructor Detail

      • AbstractFlowMessage

        AbstractFlowMessage​(java.lang.String text,
                            Message message)
    • Method Detail

      • getFormattedMessage

        public java.lang.String getFormattedMessage()
        Description copied from interface: Message
        Gets the Message formatted as a String. Each Message implementation determines the appropriate way to format the data encapsulated in the Message. Messages that provide more than one way of formatting the Message will implement MultiformatMessage.

        When configured to log asynchronously, this method is called before the Message is queued, unless this message implements ReusableMessage or is annotated with AsynchronouslyFormattable. This gives the Message implementation class a chance to create a formatted message String with the current value of any mutable objects. The intention is that the Message implementation caches this formatted message and returns it on subsequent calls. (See LOG4J2-763.)

        When logging synchronously, this method will not be called for Messages that implement the StringBuilderFormattable interface: instead, the formatTo(StringBuilder) method will be called so the Message can format its contents without creating intermediate String objects.

        Specified by:
        getFormattedMessage in interface Message
        Returns:
        The message String.
      • getFormat

        public java.lang.String getFormat()
        Description copied from interface: Message
        This method has unclear semantics and inconsistent implementations – its usage is strongly discouraged.
        Specified by:
        getFormat in interface Message
      • getParameters

        public java.lang.Object[] getParameters()
        Description copied from interface: Message
        Gets parameter values, if any.
        Specified by:
        getParameters in interface Message
        Returns:
        An array of parameter values or null.
      • getThrowable

        public java.lang.Throwable getThrowable()
        Description copied from interface: Message
        Gets the throwable, if any.
        Specified by:
        getThrowable in interface Message
        Returns:
        the throwable or null.
      • getText

        public java.lang.String getText()
        Description copied from interface: FlowMessage
        The message text like "Enter" or "Exit" used to prefix the actual Message.
        Specified by:
        getText in interface FlowMessage
        Returns:
        message text used to prefix the actual Message.
      • formatTo

        public void formatTo​(java.lang.StringBuilder buffer)
        Description copied from interface: StringBuilderFormattable
        Writes a text representation of this object into the specified StringBuilder, ideally without allocating temporary objects.
        Specified by:
        formatTo in interface StringBuilderFormattable
        Parameters:
        buffer - the StringBuilder to write into