- 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 Summary
Constructors Constructor Description Converter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Stringconvert(E event)The convert method is responsible for extracting data from the event and returning a formatted string representation.Converter<E>getNext()Gets the next converter in the chain.voidsetNext(Converter<E> next)Sets the next converter in the chain.voidwrite(StringBuilder buf, E event)Formats the event by calling convert() and appends the resulting string to the provided buffer.
-
-
-
Constructor Detail
-
Converter
public Converter()
-
-
Method Detail
-
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 appendedevent- 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
-
-