Class ColumnMapping.Builder
java.lang.Object
org.apache.logging.log4j.core.appender.db.ColumnMapping.Builder
- All Implemented Interfaces:
Builder<ColumnMapping>
- Enclosing class:
- ColumnMapping
Builder for
ColumnMapping
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the object after all configuration has been set.setColumnType
(Class<?> columnType) Class to convert value to before storing in database.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.Deprecated.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.logging.log4j.core.util.Builder
getErrorPrefix, isValid
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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.
-
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.
-
setColumnType
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.
-
setType
Deprecated.- See Also:
-
toString
-