Interface ComponentBuilder<T extends ComponentBuilder<T>>
- Type Parameters:
T
- The ComponentBuilder's own type for fluent APIs.
- All Known Subinterfaces:
AppenderComponentBuilder
,AppenderRefComponentBuilder
,CompositeFilterComponentBuilder
,CustomLevelComponentBuilder
,FilterableComponentBuilder<T>
,FilterComponentBuilder
,KeyValuePairComponentBuilder
,LayoutComponentBuilder
,LoggableComponentBuilder<T>
,LoggerComponentBuilder
,PropertyComponentBuilder
,RootLoggerComponentBuilder
,ScriptComponentBuilder
,ScriptFileComponentBuilder
Builds arbitrary components and is the base type for the provided components.
- Since:
- 2.4
-
Method Summary
Modifier and TypeMethodDescriptionaddAttribute
(String key, boolean value) Adds a boolean attribute.addAttribute
(String key, int value) Adds an integer attribute.addAttribute
(String key, Enum<?> value) Adds an enumeration attribute.addAttribute
(String key, Object value) Adds an Object attribute.addAttribute
(String key, String value) Adds a String attribute.addAttribute
(String key, Level level) Adds a logging Level attribute.addComponent
(ComponentBuilder<?> builder) Adds a sub component.ConfigurationBuilder<? extends Configuration>
Retrieves the ConfigurationBuilder.getName()
Returns the name of the component, if any.Methods inherited from interface org.apache.logging.log4j.core.util.Builder
build, getErrorPrefix, isValid
-
Method Details
-
addAttribute
Adds a String attribute.- Parameters:
key
- The attribute key.value
- The value of the attribute.- Returns:
- This ComponentBuilder.
-
addAttribute
Adds a logging Level attribute.- Parameters:
key
- The attribute key.level
- The logging Level.- Returns:
- This ComponentBuilder.
-
addAttribute
Adds an enumeration attribute.- Parameters:
key
- The attribute key.value
- The enumeration.- Returns:
- This ComponentBuilder.
-
addAttribute
Adds an integer attribute.- Parameters:
key
- The attribute key.value
- The integer value.- Returns:
- This ComponentBuilder.
-
addAttribute
Adds a boolean attribute.- Parameters:
key
- The attribute key.value
- The boolean value.- Returns:
- This ComponentBuilder.
-
addAttribute
Adds an Object attribute.- Parameters:
key
- The attribute key.value
- The object value.- Returns:
- This ComponentBuilder.
-
addComponent
Adds a sub component.- Parameters:
builder
- The Assembler for the subcomponent with all of its attributes and sub-components set.- Returns:
- This ComponentBuilder (not the argument).
-
getName
String getName()Returns the name of the component, if any.- Returns:
- The component's name or null if it doesn't have one.
-
getBuilder
ConfigurationBuilder<? extends Configuration> getBuilder()Retrieves the ConfigurationBuilder.- Returns:
- The ConfigurationBuilder.
-