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
Builder for
ColumnMapping
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
setConfiguration
(Configuration configuration) setLayout
(StringLayout layout) Layout of value to write to database (before type conversion).setLiteral
(String literal) Literal value to use for populating a column.Column name.setParameter
(String parameter) Parameter value to use for populating a column, MUST contain a single parameter marker '?'.setPattern
(String pattern) Pattern to use as aPatternLayout
.Source name.Class to convert value to before storing in database.setTypeConverterFactory
(TypeConverterFactory typeConverterFactory) toString()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
- Specified by:
build
in interfaceBuilder<ColumnMapping>
-
setConfiguration
-
setLayout
Layout of value to write to database (before type conversion). Not applicable ifsetType(Class)
is aReadOnlyStringMap
,ThreadContextMap
, orThreadContextStack
.- Returns:
- this.
-
setLiteral
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
Column name.- Returns:
- this.
-
setParameter
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
Pattern to use as aPatternLayout
. Convenient shorthand forsetLayout(StringLayout)
with a PatternLayout.- Returns:
- this.
-
setSource
Source name. Useful when combined with aMapMessage
depending on the appender.- Returns:
- this.
-
setType
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.- Returns:
- this.
-
setTypeConverterFactory
@Inject public ColumnMapping.Builder setTypeConverterFactory(TypeConverterFactory typeConverterFactory) -
toString
-