Class DefaultComponentBuilder<T extends ComponentBuilder<T>,CB extends ConfigurationBuilder<? extends Configuration>>
- java.lang.Object
-
- org.apache.logging.log4j.core.config.builder.impl.DefaultComponentBuilder<T,CB>
-
- All Implemented Interfaces:
ComponentBuilder<T>,Builder<Component>
- Direct Known Subclasses:
DefaultComponentAndConfigurationBuilder
class DefaultComponentBuilder<T extends ComponentBuilder<T>,CB extends ConfigurationBuilder<? extends Configuration>> extends java.lang.Object implements ComponentBuilder<T>
Generic component that captures attributes and Components in preparation for assembling the Appender's Component.- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>attributesprivate CBbuilderprivate java.util.List<Component>componentsprivate java.lang.Stringnameprivate java.lang.Stringtypeprivate java.lang.Stringvalue
-
Constructor Summary
Constructors Constructor Description DefaultComponentBuilder(CB builder, java.lang.String type)DefaultComponentBuilder(CB builder, java.lang.String name, java.lang.String type)DefaultComponentBuilder(CB builder, java.lang.String name, java.lang.String type, java.lang.String value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaddAttribute(java.lang.String key, boolean value)Adds a boolean attribute.TaddAttribute(java.lang.String key, int value)Adds an integer attribute.TaddAttribute(java.lang.String key, java.lang.Enum<?> value)Adds an enumeration attribute.TaddAttribute(java.lang.String key, java.lang.Object value)Adds an Object attribute.TaddAttribute(java.lang.String key, java.lang.String value)Adds a String attribute.TaddAttribute(java.lang.String key, Level level)Adds a logging Level attribute.TaddComponent(ComponentBuilder<?> builder)Adds a sub component.Componentbuild()Builds the object after all configuration has been set.CBgetBuilder()Retrieves the ConfigurationBuilder.java.lang.StringgetName()Returns the name of the component, if any.protected Tput(java.lang.String key, java.lang.String value)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.logging.log4j.core.util.Builder
getErrorPrefix, isValid
-
-
-
-
Field Detail
-
builder
private final CB extends ConfigurationBuilder<? extends Configuration> builder
-
type
private final java.lang.String type
-
attributes
private final java.util.Map<java.lang.String,java.lang.String> attributes
-
components
private final java.util.List<Component> components
-
name
private final java.lang.String name
-
value
private final java.lang.String value
-
-
Constructor Detail
-
DefaultComponentBuilder
public DefaultComponentBuilder(CB builder, java.lang.String type)
-
DefaultComponentBuilder
public DefaultComponentBuilder(CB builder, java.lang.String name, java.lang.String type)
-
DefaultComponentBuilder
public DefaultComponentBuilder(CB builder, java.lang.String name, java.lang.String type, java.lang.String value)
-
-
Method Detail
-
addAttribute
public T addAttribute(java.lang.String key, boolean value)
Description copied from interface:ComponentBuilderAdds a boolean attribute.- Specified by:
addAttributein interfaceComponentBuilder<T extends ComponentBuilder<T>>- Parameters:
key- The attribute key.value- The boolean value.- Returns:
- This ComponentBuilder.
-
addAttribute
public T addAttribute(java.lang.String key, java.lang.Enum<?> value)
Description copied from interface:ComponentBuilderAdds an enumeration attribute.- Specified by:
addAttributein interfaceComponentBuilder<T extends ComponentBuilder<T>>- Parameters:
key- The attribute key.value- The enumeration.- Returns:
- This ComponentBuilder.
-
addAttribute
public T addAttribute(java.lang.String key, int value)
Description copied from interface:ComponentBuilderAdds an integer attribute.- Specified by:
addAttributein interfaceComponentBuilder<T extends ComponentBuilder<T>>- Parameters:
key- The attribute key.value- The integer value.- Returns:
- This ComponentBuilder.
-
addAttribute
public T addAttribute(java.lang.String key, Level level)
Description copied from interface:ComponentBuilderAdds a logging Level attribute.- Specified by:
addAttributein interfaceComponentBuilder<T extends ComponentBuilder<T>>- Parameters:
key- The attribute key.level- The logging Level.- Returns:
- This ComponentBuilder.
-
addAttribute
public T addAttribute(java.lang.String key, java.lang.Object value)
Description copied from interface:ComponentBuilderAdds an Object attribute.- Specified by:
addAttributein interfaceComponentBuilder<T extends ComponentBuilder<T>>- Parameters:
key- The attribute key.value- The object value.- Returns:
- This ComponentBuilder.
-
addAttribute
public T addAttribute(java.lang.String key, java.lang.String value)
Description copied from interface:ComponentBuilderAdds a String attribute.- Specified by:
addAttributein interfaceComponentBuilder<T extends ComponentBuilder<T>>- Parameters:
key- The attribute key.value- The value of the attribute.- Returns:
- This ComponentBuilder.
-
addComponent
public T addComponent(ComponentBuilder<?> builder)
Description copied from interface:ComponentBuilderAdds a sub component.- Specified by:
addComponentin interfaceComponentBuilder<T extends ComponentBuilder<T>>- Parameters:
builder- The Assembler for the subcomponent with all of its attributes and sub-components set.- Returns:
- This ComponentBuilder (not the argument).
-
build
public Component 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<T extends ComponentBuilder<T>>- Returns:
- the configured instance.
-
getBuilder
public CB getBuilder()
Description copied from interface:ComponentBuilderRetrieves the ConfigurationBuilder.- Specified by:
getBuilderin interfaceComponentBuilder<T extends ComponentBuilder<T>>- Returns:
- The ConfigurationBuilder.
-
getName
public java.lang.String getName()
Description copied from interface:ComponentBuilderReturns the name of the component, if any.- Specified by:
getNamein interfaceComponentBuilder<T extends ComponentBuilder<T>>- Returns:
- The components name or null if it doesn't have one.
-
put
protected T put(java.lang.String key, java.lang.String value)
-
-