openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r567897 - /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
Date Tue, 21 Aug 2007 01:28:12 GMT
Author: pcl
Date: Mon Aug 20 18:28:12 2007
New Revision: 567897

URL: http://svn.apache.org/viewvc?rev=567897&view=rev
Log:
If a getter is marked @Transient, be a bit more quiet about compliance warnings.

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java?rev=567897&r1=567896&r2=567897&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java
Mon Aug 20 18:28:12 2007
@@ -296,13 +296,14 @@
                         meta.getDescribedType(), "set" +
                         StringUtils.capitalize(name), new Class[] { 
                             ((Method) member).getReturnType() }));
-                if (setter == null) {
+                if (setter == null && !isAnnotatedTransient(member)) {
                     logNoSetter(meta, name, null);
                     return false;
                 }
             } catch (Exception e) {
                 // e.g., NoSuchMethodException
-                logNoSetter(meta, name, e);
+                if (!isAnnotatedTransient(member))
+                    logNoSetter(meta, name, e);
                 return false;
             }
         }
@@ -312,6 +313,11 @@
             return false;
         return true;
 	}
+
+    private boolean isAnnotatedTransient(Member member) {
+        return member instanceof AnnotatedElement
+            && ((AnnotatedElement) member).isAnnotationPresent(Transient.class);
+    }
 
     private void logNoSetter(ClassMetaData meta, String name, Exception e) {
         Log log = meta.getRepository().getConfiguration()



Mime
View raw message