Class Converter<E>

java.lang.Object
ch.qos.logback.core.pattern.Converter<E>
Type Parameters:
E - The type of the event object
Direct Known Subclasses:
FormattingConverter, LiteralConverter

public abstract class Converter<E> extends Object
A minimal converter which sets up the general interface for derived classes. It also implements the functionality to chain converters in a linked list.
Author:
ceki
  • Constructor Details

  • Method Details

    • convert

      public abstract String convert(E event)
      The convert method is responsible for extracting data from the event and returning a formatted string representation.
      Parameters:
      event - the event to convert
      Returns:
      the formatted string representation
    • write

      public void write(StringBuilder buf, E event)
      Formats the event by calling convert() and appends the resulting string to the provided buffer.
      Parameters:
      buf - The input buffer where data is appended
      event - The event from where data is extracted
    • setNext

      public final void setNext(Converter<E> next)
      Sets the next converter in the chain. This method can only be called once per converter instance.
      Parameters:
      next - the next converter to chain
      Throws:
      IllegalStateException - if next has already been set
    • getNext

      public final Converter<E> getNext()
      Gets the next converter in the chain.
      Returns:
      the next converter, or null if not set