Class ColumnMapping.Builder

java.lang.Object
org.apache.logging.log4j.core.appender.db.ColumnMapping.Builder
All Implemented Interfaces:
Supplier<ColumnMapping>, Builder<ColumnMapping>
Enclosing class:
ColumnMapping

public static class ColumnMapping.Builder extends Object implements Builder<ColumnMapping>
Builder for ColumnMapping.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public ColumnMapping build()
      Specified by:
      build in interface Builder<ColumnMapping>
    • setConfiguration

      public ColumnMapping.Builder setConfiguration(Configuration configuration)
    • setLayout

      public ColumnMapping.Builder setLayout(StringLayout layout)
      Layout of value to write to database (before type conversion). Not applicable if setType(Class) is a ReadOnlyStringMap, ThreadContextMap, or ThreadContextStack.
      Returns:
      this.
    • setLiteral

      public ColumnMapping.Builder setLiteral(String literal)
      Literal value to use for populating a column. This is generally useful for functions, stored procedures, etc. No escaping will be done on this value.
      Returns:
      this.
    • setName

      public ColumnMapping.Builder setName(String name)
      Column name.
      Returns:
      this.
    • setParameter

      public ColumnMapping.Builder setParameter(String parameter)
      Parameter value to use for populating a column, MUST contain a single parameter marker '?'. This is generally useful for functions, stored procedures, etc. No escaping will be done on this value.
      Returns:
      this.
    • setPattern

      public ColumnMapping.Builder setPattern(String pattern)
      Pattern to use as a PatternLayout. Convenient shorthand for setLayout(StringLayout) with a PatternLayout.
      Returns:
      this.
    • setSource

      public ColumnMapping.Builder setSource(String source)
      Source name. Useful when combined with a MapMessage depending on the appender.
      Returns:
      this.
    • setType

      public ColumnMapping.Builder setType(Class<?> type)
      Class to convert value to before storing in database. If the type is compatible with ThreadContextMap or ReadOnlyStringMap, then the MDC will be used. If the type is compatible with ThreadContextStack, then the NDC will be used. If the type is compatible with Date, then the event timestamp will be used.
      Returns:
      this.
    • setTypeConverterFactory

      @Inject public ColumnMapping.Builder setTypeConverterFactory(TypeConverterFactory typeConverterFactory)
    • toString

      public String toString()
      Overrides:
      toString in class Object