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>
Builder forColumnMapping.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnMappingbuild()Builds the object after all configuration has been set.ColumnMapping.BuildersetConfiguration(Configuration configuration)ColumnMapping.BuildersetLayout(StringLayout layout)Layout of value to write to database (before type conversion).ColumnMapping.BuildersetLiteral(java.lang.String literal)Literal value to use for populating a column.ColumnMapping.BuildersetName(java.lang.String name)Column name.ColumnMapping.BuildersetParameter(java.lang.String parameter)Parameter value to use for populating a column, MUST contain a single parameter marker '?'.ColumnMapping.BuildersetPattern(java.lang.String pattern)Pattern to use as aPatternLayout.ColumnMapping.BuildersetSource(java.lang.String source)Source name.ColumnMapping.BuildersetType(java.lang.Class<?> type)Class to convert value to before storing in database.java.lang.StringtoString()
-
-
-
Method Detail
-
build
public ColumnMapping build()
Description copied from interface:BuilderBuilds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
buildin interfaceBuilder<ColumnMapping>- Returns:
- the configured instance.
-
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 ifsetType(Class)is aReadOnlyStringMap,ThreadContextMap, orThreadContextStack.- Returns:
- this.
-
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.- Returns:
- this.
-
setName
public ColumnMapping.Builder setName(java.lang.String name)
Column name.- Returns:
- this.
-
setParameter
public ColumnMapping.Builder setParameter(java.lang.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(java.lang.String pattern)
Pattern to use as aPatternLayout. Convenient shorthand forsetLayout(StringLayout)with a PatternLayout.- Returns:
- this.
-
setSource
public ColumnMapping.Builder setSource(java.lang.String source)
Source name. Useful when combined with aMapMessagedepending on the appender.- Returns:
- this.
-
setType
public ColumnMapping.Builder setType(java.lang.Class<?> type)
Class to convert value to before storing in database. If the type is compatible withThreadContextMaporReadOnlyStringMap, 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-