tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1210426 - /tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
Date Mon, 05 Dec 2011 12:26:10 GMT
Author: antelder
Date: Mon Dec  5 12:26:10 2011
New Revision: 1210426

URL: http://svn.apache.org/viewvc?rev=1210426&view=rev
Log:
TUSCANY-3965: Fix so that fields that are candidates for being properties but which have some
annotation on them then are not used as properties

Modified:
    tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java?rev=1210426&r1=1210425&r2=1210426&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
Mon Dec  5 12:26:10 2011
@@ -162,6 +162,13 @@ public class HeuristicPojoProcessor exte
         return false;
     }
 
+    private static boolean isAnnotated(AnnotatedElement element) {
+        for (Annotation a : element.getAnnotations()) {
+            return true;
+        }
+        return false;
+    }
+    
     private static boolean isSCAAnnotation(Annotation a) {
         return a.annotationType().getName().startsWith("org.oasisopen.sca.annotation.");
     }
@@ -261,8 +268,10 @@ public class HeuristicPojoProcessor exte
                 }
             } else {
                 if (!type.getPropertyMembers().containsKey(name)) {
-                    type.getProperties().add(createProperty(name, paramType, genericType));
-                    type.getPropertyMembers().put(name, new JavaElementImpl(field));
+                    if (!isAnnotated(field)) { // if the field has an annotation then its
not a property
+                        type.getProperties().add(createProperty(name, paramType, genericType));
+                        type.getPropertyMembers().put(name, new JavaElementImpl(field));
+                    }
                 }
             }
         }



Mime
View raw message