You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/06/09 01:01:53 UTC

svn commit: r664574 - in /tapestry/tapestry5/trunk: tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ tapestry-core/src/test/java/org/apache/tapestry5/internal/transform/ tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/s...

Author: hlship
Date: Sun Jun  8 16:01:52 2008
New Revision: 664574

URL: http://svn.apache.org/viewvc?rev=664574&view=rev
Log:
TAPESTRY-2439: The PropertyAdapter interface should include a property to identify the containing class

Removed:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/ComponentLifecycleMethodWorker.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/transform/ComponentLifecycleMethodWorkerTest.java
Modified:
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PropertyAdapterImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PropertyAdapter.java

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java?rev=664574&r1=664573&r2=664574&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/ClassPropertyAdapterImpl.java Sun Jun  8 16:01:52 2008
@@ -47,7 +47,7 @@
             Class propertyType = readMethod == null ? pd.getPropertyType() : GenericsUtils.extractGenericReturnType(
                     beanType, readMethod);
 
-            PropertyAdapter pa = new PropertyAdapterImpl(beanType, pd.getName(), propertyType, readMethod,
+            PropertyAdapter pa = new PropertyAdapterImpl(this, pd.getName(), propertyType, readMethod,
                                                          pd.getWriteMethod());
 
             adapters.put(pa.getName(), pa);

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PropertyAdapterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PropertyAdapterImpl.java?rev=664574&r1=664573&r2=664574&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PropertyAdapterImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PropertyAdapterImpl.java Sun Jun  8 16:01:52 2008
@@ -14,8 +14,7 @@
 
 package org.apache.tapestry5.ioc.internal.services;
 
-import static org.apache.tapestry5.ioc.internal.util.Defense.notBlank;
-import static org.apache.tapestry5.ioc.internal.util.Defense.notNull;
+import org.apache.tapestry5.ioc.services.ClassPropertyAdapter;
 import org.apache.tapestry5.ioc.services.PropertyAdapter;
 
 import java.lang.annotation.Annotation;
@@ -25,7 +24,7 @@
 
 public class PropertyAdapterImpl implements PropertyAdapter
 {
-    private final Class beanType;
+    private final ClassPropertyAdapter classAdapter;
 
     private final String name;
 
@@ -47,11 +46,12 @@
      */
     private Field field;
 
-    public PropertyAdapterImpl(Class beanType, String name, Class type, Method readMethod, Method writeMethod)
+    PropertyAdapterImpl(ClassPropertyAdapter classAdapter, String name, Class type, Method readMethod,
+                        Method writeMethod)
     {
-        this.beanType = notNull(beanType, "beanType");
-        this.name = notBlank(name, "name");
-        this.type = notNull(type, "type");
+        this.classAdapter = classAdapter;
+        this.name = name;
+        this.type = type;
 
         this.readMethod = readMethod;
         this.writeMethod = writeMethod;
@@ -165,7 +165,7 @@
             // are in the same class (i.e., that we don't have a getter exposing a protected field inherted
             // from a base class, or some other oddity).
 
-            for (Field f : beanType.getDeclaredFields())
+            for (Field f : getBeanType().getDeclaredFields())
             {
                 if (f.getName().equalsIgnoreCase(name))
                 {
@@ -184,4 +184,14 @@
     {
         return castRequired;
     }
+
+    public ClassPropertyAdapter getClassAdapter()
+    {
+        return classAdapter;
+    }
+
+    public Class getBeanType()
+    {
+        return classAdapter.getBeanType();
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PropertyAdapter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PropertyAdapter.java?rev=664574&r1=664573&r2=664574&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PropertyAdapter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PropertyAdapter.java Sun Jun  8 16:01:52 2008
@@ -81,4 +81,17 @@
      * is something more specific. This method is primarily used when generating runtime code related to the property.
      */
     boolean isCastRequired();
+
+
+    /**
+     * Returns the {@link org.apache.tapestry5.ioc.services.ClassPropertyAdapter} that provides access to other
+     * properties defined by the same class.
+     */
+    ClassPropertyAdapter getClassAdapter();
+
+    /**
+     * Returns the type of bean to which this property belongs.  This is the same as {@link
+     * org.apache.tapestry5.ioc.services.ClassPropertyAdapter#getBeanType()}.
+     */
+    Class getBeanType();
 }