From b0c5cfe69a76e3db981a0940350e37292fc59c1b Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Tue, 21 Aug 2007 01:28:12 +0000 Subject: [PATCH] If a getter is marked @Transient, be a bit more quiet about compliance warnings. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@567897 13f79535-47bb-0310-9956-ffa450edef68 --- .../persistence/PersistenceMetaDataDefaults.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java index 7cff80dbb..17c7e8001 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataDefaults.java @@ -296,13 +296,14 @@ public class PersistenceMetaDataDefaults 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; } } @@ -313,6 +314,11 @@ public class PersistenceMetaDataDefaults 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() .getLog(OpenJPAConfiguration.LOG_METADATA);