org.apache.logging.log4j.core.config.plugins.util
Class PluginBuilder<T>

java.lang.Object
  extended by org.apache.logging.log4j.core.config.plugins.util.PluginBuilder<T>
Type Parameters:
T - type of Plugin class.
All Implemented Interfaces:
Builder<T>

public class PluginBuilder<T>
extends Object
implements Builder<T>

Builder class to instantiate and configure a Plugin object using a PluginFactory method or PluginBuilderFactory builder class.


Constructor Summary
PluginBuilder(PluginType<T> pluginType)
          Constructs a PluginBuilder for a given PluginType.
 
Method Summary
 T build()
          Builds the plugin object.
 PluginBuilder<T> forLogEvent(LogEvent event)
          Specifies the LogEvent that may be used to provide extra context for string substitutions.
 PluginBuilder<T> withConfiguration(Configuration configuration)
          Specifies the Configuration to use for constructing the plugin instance.
 PluginBuilder<T> withConfigurationNode(Node node)
          Specifies the Node corresponding to the plugin object that will be created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginBuilder

public PluginBuilder(PluginType<T> pluginType)
Constructs a PluginBuilder for a given PluginType.

Parameters:
pluginType - type of plugin to configure
Method Detail

withConfiguration

public PluginBuilder<T> withConfiguration(Configuration configuration)
Specifies the Configuration to use for constructing the plugin instance.

Parameters:
configuration - the configuration to use.
Returns:
this

withConfigurationNode

public PluginBuilder<T> withConfigurationNode(Node node)
Specifies the Node corresponding to the plugin object that will be created.

Parameters:
node - the plugin configuration node to use.
Returns:
this

forLogEvent

public PluginBuilder<T> forLogEvent(LogEvent event)
Specifies the LogEvent that may be used to provide extra context for string substitutions.

Parameters:
event - the event to use for extra information.
Returns:
this

build

public T build()
Builds the plugin object.

Specified by:
build in interface Builder<T>
Returns:
the plugin object or null if there was a problem creating it.


Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.