[logback-dev] svn commit: r1709 - in logback/trunk/logback-core/src: main/java/ch/qos/logback/core/joran/action main/java/ch/qos/logback/core/util test/java/ch/qos/logback/core/util

noreply.ceki at qos.ch noreply.ceki at qos.ch
Wed Jul 16 18:38:09 CEST 2008


Author: ceki
Date: Wed Jul 16 18:38:08 2008
New Revision: 1709

Added:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/AggregationType.java
      - copied, changed from r1704, /logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/ContainmentType.java
Removed:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/ContainmentType.java
Modified:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/ImplicitActionData.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedComponentIA.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetter.java
   logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/PropertySetterTest.java

Log:


Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/ImplicitActionData.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/ImplicitActionData.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/ImplicitActionData.java	Wed Jul 16 18:38:08 2008
@@ -1,16 +1,22 @@
 package ch.qos.logback.core.joran.action;
 
-import ch.qos.logback.core.util.ContainmentType;
+import ch.qos.logback.core.util.AggregationType;
 import ch.qos.logback.core.util.PropertySetter;
 
+/**
+ * ImplicitActionData is a data class aggregating several fields.
+ * 
+ * 
+ * @author Ceki
+ */
 public class ImplicitActionData {
   PropertySetter parentBean;
   String propertyName;
   Object nestedComponent;
-  ContainmentType containmentType;
+  AggregationType containmentType;
   boolean inError;
 
-  ImplicitActionData(PropertySetter parentBean, ContainmentType containmentType) {
+  ImplicitActionData(PropertySetter parentBean, AggregationType containmentType) {
     this.parentBean = parentBean;
     this.containmentType = containmentType;
   }

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedComponentIA.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedComponentIA.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedComponentIA.java	Wed Jul 16 18:38:08 2008
@@ -18,7 +18,7 @@
 import ch.qos.logback.core.joran.spi.Pattern;
 import ch.qos.logback.core.spi.ContextAware;
 import ch.qos.logback.core.spi.LifeCycle;
-import ch.qos.logback.core.util.ContainmentType;
+import ch.qos.logback.core.util.AggregationType;
 import ch.qos.logback.core.util.Loader;
 import ch.qos.logback.core.util.OptionHelper;
 import ch.qos.logback.core.util.PropertySetter;
@@ -54,7 +54,7 @@
     PropertySetter parentBean = new PropertySetter(o);
     parentBean.setContext(context);
 
-    ContainmentType containmentType = parentBean
+    AggregationType containmentType = parentBean
         .canContainComponent(nestedElementTagName);
 
     switch (containmentType) {
@@ -135,7 +135,7 @@
     PropertySetter nestedBean = new PropertySetter(actionData.nestedComponent);
     nestedBean.setContext(context);
 
-    if (nestedBean.canContainComponent("parent") == ContainmentType.AS_SINGLE_COMPONENT) {
+    if (nestedBean.canContainComponent("parent") == AggregationType.AS_SINGLE_COMPONENT) {
       nestedBean.setComponent("parent", actionData.parentBean.getObj());
     }
     if (actionData.nestedComponent instanceof LifeCycle) {

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java	Wed Jul 16 18:38:08 2008
@@ -18,7 +18,7 @@
 
 import ch.qos.logback.core.joran.spi.InterpretationContext;
 import ch.qos.logback.core.joran.spi.Pattern;
-import ch.qos.logback.core.util.ContainmentType;
+import ch.qos.logback.core.util.AggregationType;
 import ch.qos.logback.core.util.PropertySetter;
 
 
@@ -55,7 +55,7 @@
     PropertySetter parentBean = new PropertySetter(o);
     parentBean.setContext(context);
     
-    ContainmentType containmentType = parentBean.canContainComponent(nestedElementTagName);
+    AggregationType containmentType = parentBean.canContainComponent(nestedElementTagName);
 
     switch (containmentType) {
     case NOT_FOUND:

Copied: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/AggregationType.java (from r1704, /logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/ContainmentType.java)
==============================================================================
--- /logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/ContainmentType.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/AggregationType.java	Wed Jul 16 18:38:08 2008
@@ -1,5 +1,9 @@
 package ch.qos.logback.core.util;
 
-public enum ContainmentType {
-  NOT_FOUND, AS_SINGLE_COMPONENT, AS_SINGLE_PROPERTY, AS_PROPERTY_COLLECTION, AS_COMPONENT_COLLECTION;
+public enum AggregationType {
+  NOT_FOUND, 
+  AS_SINGLE_COMPONENT, 
+  AS_SINGLE_PROPERTY, 
+  AS_PROPERTY_COLLECTION, 
+  AS_COMPONENT_COLLECTION;
 }

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetter.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetter.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetter.java	Wed Jul 16 18:38:08 2008
@@ -181,7 +181,7 @@
     }
   }
 
-  public ContainmentType canContainComponent(String name) {
+  public AggregationType canContainComponent(String name) {
     String cName = capitalizeFirstLetter(name);
 
     Method addMethod = getMethod("add" + cName);
@@ -190,11 +190,11 @@
       int type = computeContainmentTpye(addMethod);
       switch (type) {
       case X_NOT_FOUND:
-        return ContainmentType.NOT_FOUND;
+        return AggregationType.NOT_FOUND;
       case X_AS_PROPERTY:
-        return ContainmentType.AS_PROPERTY_COLLECTION;
+        return AggregationType.AS_PROPERTY_COLLECTION;
       case X_AS_COMPONENT:
-        return ContainmentType.AS_COMPONENT_COLLECTION;
+        return AggregationType.AS_COMPONENT_COLLECTION;
       }
     }
 
@@ -213,17 +213,17 @@
         // "Found add {} method in class {}", cName, objClass.getName());
         switch (type) {
         case X_NOT_FOUND:
-          return ContainmentType.NOT_FOUND;
+          return AggregationType.NOT_FOUND;
         case X_AS_PROPERTY:
-          return ContainmentType.AS_SINGLE_PROPERTY;
+          return AggregationType.AS_SINGLE_PROPERTY;
         case X_AS_COMPONENT:
-          return ContainmentType.AS_SINGLE_COMPONENT;
+          return AggregationType.AS_SINGLE_COMPONENT;
         }
       }
     }
 
     // we have failed
-    return ContainmentType.NOT_FOUND;
+    return AggregationType.NOT_FOUND;
   }
 
   int computeContainmentTpye(Method setterMethod) {

Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/PropertySetterTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/PropertySetterTest.java	(original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/PropertySetterTest.java	Wed Jul 16 18:38:08 2008
@@ -12,25 +12,25 @@
   public void testCanContainComponent() {
     House house = new House();
     PropertySetter setter = new PropertySetter(house);
-    assertEquals(ContainmentType.AS_SINGLE_COMPONENT, setter.canContainComponent("door"));
+    assertEquals(AggregationType.AS_SINGLE_COMPONENT, setter.canContainComponent("door"));
     
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("count"));
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("Count"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("count"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("Count"));
     
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("name"));
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("Name"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("name"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("Name"));
     
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("Duration"));
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("fs"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("Duration"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("fs"));
     
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("open"));
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("Open"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("open"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("Open"));
     
-    assertEquals(ContainmentType.AS_COMPONENT_COLLECTION, setter.canContainComponent("Window"));
-    assertEquals(ContainmentType.AS_PROPERTY_COLLECTION, setter.canContainComponent("adjective"));
+    assertEquals(AggregationType.AS_COMPONENT_COLLECTION, setter.canContainComponent("Window"));
+    assertEquals(AggregationType.AS_PROPERTY_COLLECTION, setter.canContainComponent("adjective"));
     
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("filterReply"));
-    assertEquals(ContainmentType.AS_SINGLE_PROPERTY, setter.canContainComponent("houseColor"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("filterReply"));
+    assertEquals(AggregationType.AS_SINGLE_PROPERTY, setter.canContainComponent("houseColor"));
     
     System.out.println();
   }



More information about the logback-dev mailing list