Author: clement
Date: Mon Sep 24 00:49:15 2007
New Revision: 578694

URL: http://svn.apache.org/viewvc?rev=578694&view=rev
Log:
Properties can use method from parent class to be setted :
In :
<property method="updateFoo" name="foo" type="java.lang.String"/>
The updateFoo method can be in the parent class. However, if the type of the 
property cannot be discovered (i.e. linked with a field), the type attribute 
must be set to describe the property type.

Modified:
    
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurableProperty.java
    
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java

Modified: 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurableProperty.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurableProperty.java?rev=578694&r1=578693&r2=578694&view=diff
==============================================================================
--- 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurableProperty.java
 (original)
+++ 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurableProperty.java
 Mon Sep 24 00:49:15 2007
@@ -112,6 +112,7 @@
             value = new String(strValue);
             m_type = java.lang.String.class;
         }
+               
         if (type.equals("boolean")) {
             value = new Boolean(strValue);
             m_type = Boolean.TYPE;

Modified: 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java?rev=578694&r1=578693&r2=578694&view=diff
==============================================================================
--- 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
 (original)
+++ 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
 Mon Sep 24 00:49:15 2007
@@ -175,11 +175,7 @@
                 ff.add(fm);
             } else {
                 MethodMetadata[] mm = manipulation.getMethods(methodName);
-                if (mm.length == 0) {
-                    m_manager.getFactory().getLogger().log(Logger.ERROR,
-                            "[" + m_manager.getClassName() + "] The method " + 
methodName + " does not exist in the implementation");
-                    return;
-                } else {
+                if (mm.length != 0) {
                     if (mm[0].getMethodArguments().length != 1) {
                         m_manager.getFactory().getLogger().log(Logger.ERROR,
                                 "[" + m_manager.getClassName() + "] The method 
" + methodName + " does not have one argument");
@@ -191,7 +187,15 @@
                         return;
                     }
                     type = mm[0].getMethodArguments()[0];
-                }
+                } else {
+                                       // Else, the method is in a super 
class, look for the type attribute to get the type (if not already discovered)
+                                       if (type == null && 
configurables[i].containsAttribute("type")) { 
+                                                       type = 
configurables[i].getAttribute("type"); 
+                                       } else {
+                                               
m_manager.getFactory().getLogger().log(Logger.ERROR, "The type of the property 
cannot be discovered, please add a 'type' attribute");
+                                               return;
+                                       }
+                               }
             }
 
             ConfigurableProperty cp = new ConfigurableProperty(name, 
fieldName, methodName, value, type, this);
@@ -224,10 +228,10 @@
     }
 
     /**
-     * Stop method.
-     * Do nothing.
-     * @see org.apache.felix.ipojo.Handler#stop()
-     */
+      * Stop method.
+      * Do nothing.
+      * @see org.apache.felix.ipojo.Handler#stop()
+      */
     public void stop() {
     }
 


Reply via email to