Class ColumnMapping.Builder
- java.lang.Object
-
- org.apache.logging.log4j.core.appender.db.ColumnMapping.Builder
-
- All Implemented Interfaces:
Builder<ColumnMapping>
- Enclosing class:
- ColumnMapping
public static class ColumnMapping.Builder extends java.lang.Object implements Builder<ColumnMapping>
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnMapping
build()
Builds the object after all configuration has been set.ColumnMapping.Builder
setConfiguration(Configuration configuration)
ColumnMapping.Builder
setLayout(StringLayout layout)
Layout of value to write to database (before type conversion).ColumnMapping.Builder
setLiteral(java.lang.String literal)
Literal value to use for populating a column.ColumnMapping.Builder
setName(java.lang.String name)
Column name.ColumnMapping.Builder
setPattern(java.lang.String pattern)
Pattern to use as aPatternLayout
.ColumnMapping.Builder
setType(java.lang.Class<?> type)
Class to convert value to before storing in database.
-
-
-
Method Detail
-
setName
public ColumnMapping.Builder setName(java.lang.String name)
Column name.
-
setLayout
public ColumnMapping.Builder setLayout(StringLayout layout)
Layout of value to write to database (before type conversion). Not applicable ifsetType(Class)
is aReadOnlyStringMap
,ThreadContextMap
, orThreadContextStack
.
-
setPattern
public ColumnMapping.Builder setPattern(java.lang.String pattern)
Pattern to use as aPatternLayout
. Convenient shorthand forsetLayout(StringLayout)
with a PatternLayout.
-
setLiteral
public ColumnMapping.Builder setLiteral(java.lang.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.
-
setType
public ColumnMapping.Builder setType(java.lang.Class<?> type)
Class to convert value to before storing in database. If the type is compatible withThreadContextMap
orReadOnlyStringMap
, then the MDC will be used. If the type is compatible withThreadContextStack
, then the NDC will be used. If the type is compatible withDate
, then the event timestamp will be used.
-
setConfiguration
public ColumnMapping.Builder setConfiguration(Configuration configuration)
-
build
public ColumnMapping build()
Description copied from interface:Builder
Builds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
build
in interfaceBuilder<ColumnMapping>
- Returns:
- the configured instance.
-
-