Enum Class EventFormatter

java.lang.Object
java.lang.Enum<EventFormatter>
com.github.eventmanager.formatters.EventFormatter
All Implemented Interfaces:
Serializable, Comparable<EventFormatter>, Constable

public enum EventFormatter extends Enum<EventFormatter>
The EventFormatter enum provides different formatting strategies for event logs. Each formatter formats the event metadata and arguments in a specific way.
  • Enum Constant Details

    • DEFAULT

      public static final EventFormatter DEFAULT
      The DEFAULT formatter formats the event metadata and arguments in a default format.
    • KEY_VALUE

      public static final EventFormatter KEY_VALUE
      The KEY_VALUE formatter formats the event metadata and arguments in a key-value format.
    • CSV

      public static final EventFormatter CSV
      The CSV formatter formats the event metadata and arguments in a CSV format.
    • XML

      public static final EventFormatter XML
      The XML formatter formats the event metadata and arguments in an XML format.
    • JSON

      public static final EventFormatter JSON
      The JSON formatter formats the event metadata and arguments in a JSON format.
  • Method Details

    • values

      public static EventFormatter[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EventFormatter valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • format

      public abstract String format(Map<String,String> metadata, KeyValueWrapper... args)
      Formats the event metadata and arguments.
      Parameters:
      metadata - the event metadata.
      args - the event arguments.
      Returns:
      the formatted event as a string.
    • format

      public abstract String format(Map<String,String> metadata, String message)
      Formats the event metadata and message.
      Parameters:
      metadata - the event metadata.
      message - the event message.
      Returns:
      the formatted event as a string.
    • formatElement

      public abstract String formatElement(KeyValueWrapper arg)
      Formats the event element.
      Parameters:
      arg - the event element.
      Returns:
      the formatted event element as a string.
    • formatArguments

      public abstract String formatArguments(String body, KeyValueWrapper... args)
      Formats the event arguments.
      Parameters:
      body - the argument keyword.
      args - the event arguments.
      Returns:
      the formatted event arguments as a string.