You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2014/05/26 01:00:21 UTC
svn commit: r1597484 -
/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ConfigurablePluginBuilder.java
Author: mattsicker
Date: Sun May 25 23:00:21 2014
New Revision: 1597484
URL: http://svn.apache.org/r1597484
Log:
Add interface for building plugins in Java instead of XML/JSON.
- Part of LOG4J2-653.
Added:
logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ConfigurablePluginBuilder.java (with props)
Added: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ConfigurablePluginBuilder.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ConfigurablePluginBuilder.java?rev=1597484&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ConfigurablePluginBuilder.java (added)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ConfigurablePluginBuilder.java Sun May 25 23:00:21 2014
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.core.config.plugins.util;
+
+/**
+ * A type of Plugin builder that can be used to configure and create a plugin instance using a Java DSL instead of
+ * through a configuration file. These builders are primarily useful for internal code and unit tests, but they can
+ * technically be used as a verbose alternative to configuration files.
+ *
+ * <p>
+ * When creating plugin builders, it is customary to create the builder class as a public static inner class
+ * called {@code Builder}. For instance, the builder class for
+ * {@link org.apache.logging.log4j.core.layout.PatternLayout PatternLayout} would be
+ * {@code PatternLayout.Builder}.
+ * </p>
+ *
+ * @param <T> the Plugin class this is a builder for.
+ */
+public interface ConfigurablePluginBuilder<T> {
+
+ /**
+ * Builds the plugin object after all configuration has been set. This will use default values for any
+ * unspecified attributes for the plugin.
+ *
+ * @return the configured plugin instance.
+ */
+ T build();
+}
Propchange: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ConfigurablePluginBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native