[weld-commits] Weld SVN: r6415 - extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Tue Jun 8 19:58:09 EDT 2010


Author: shane.bryzak at jboss.com
Date: 2010-06-08 19:58:08 -0400 (Tue, 08 Jun 2010)
New Revision: 6415

Modified:
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldPropertyImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodPropertyImpl.java
   extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java
Log:
add support for returning the declaring class

Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldPropertyImpl.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldPropertyImpl.java	2010-06-08 11:32:11 UTC (rev 6414)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldPropertyImpl.java	2010-06-08 23:58:08 UTC (rev 6415)
@@ -91,4 +91,9 @@
       }
    }
 
+   public Class<?> getDeclaringClass()
+   {
+      return field.getDeclaringClass();
+   }
+
 }
\ No newline at end of file

Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodPropertyImpl.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodPropertyImpl.java	2010-06-08 11:32:11 UTC (rev 6414)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodPropertyImpl.java	2010-06-08 23:58:08 UTC (rev 6415)
@@ -64,7 +64,7 @@
       return getJavaClass().cast(invokeMethod(getterMethod, instance));
    }
    
-   public void setValue(Object instance, Object value) 
+   public void setValue(Object instance, V value) 
    {
       invokeMethod(setterMethod, instance, value);
    }
@@ -150,5 +150,11 @@
          }
       }
       throw new IllegalArgumentException("no such getter method: " + clazz.getName() + '.' + name);
-   }   
+   }
+
+   public Class<?> getDeclaringClass()
+   {
+      return getterMethod.getDeclaringClass();
+   }
+
 }
\ No newline at end of file

Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java	2010-06-08 11:32:11 UTC (rev 6414)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java	2010-06-08 23:58:08 UTC (rev 6415)
@@ -15,7 +15,6 @@
  */
 public interface Property<V>
 {
-   
    /**
     * Returns the name of the property. If the property is a field, then the
     * field name is returned. Otherwise, if the property is a method, then the
@@ -65,4 +64,11 @@
     * @param value The new property value
     */
    public void setValue(Object instance, V value);   
+   
+   /**
+    * Returns the class that declares the property
+    * 
+    * @return
+    */
+   public Class<?> getDeclaringClass();
 }
\ No newline at end of file



More information about the weld-commits mailing list