logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattsic...@apache.org
Subject svn commit: r1586089 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
Date Wed, 09 Apr 2014 19:22:11 GMT
Author: mattsicker
Date: Wed Apr  9 19:22:10 2014
New Revision: 1586089

URL: http://svn.apache.org/r1586089
Log:
Extract method.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java?rev=1586089&r1=1586088&r2=1586089&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
Wed Apr  9 19:22:10 2014
@@ -683,6 +683,7 @@ public abstract class AbstractConfigurat
     */
     private <T> Object createPluginObject(final PluginType<T> type, final Node
node, final LogEvent event)
     {
+        // TODO: add support for type conversion
         final Class<T> clazz = type.getPluginClass();
 
         if (Map.class.isAssignableFrom(clazz)) {
@@ -730,12 +731,7 @@ public abstract class AbstractConfigurat
          *   If not an array, store the object in the child node into the parameter array.
          */
         for (final Annotation[] parmTypes : parmArray) {
-            String[] aliases = null;
-            for (final Annotation a : parmTypes) {
-                if (a instanceof PluginAliases) {
-                    aliases = ((PluginAliases) a).value();
-                }
-            }
+            String[] aliases = extractPluginAliases(parmTypes);
             for (final Annotation a : parmTypes) {
                 if (a instanceof PluginAliases) {
                     continue;
@@ -898,6 +894,16 @@ public abstract class AbstractConfigurat
         return null;
     }
 
+    private String[] extractPluginAliases(final Annotation... parmTypes) {
+        String[] aliases = null;
+        for (final Annotation a : parmTypes) {
+            if (a instanceof PluginAliases) {
+                aliases = ((PluginAliases) a).value();
+            }
+        }
+        return aliases;
+    }
+
     private <T> Object createPluginMap(final Node node, final Class<T> clazz)
throws InstantiationException, IllegalAccessException {
         @SuppressWarnings("unchecked")
         final Map<String, Object> map = (Map<String, Object>) clazz.newInstance();



Mime
View raw message