db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r161696 - in incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl: enhancer/meta/model/EnhancerMetaDataJDOModelImpl.java model/java/runtime/RegisterClassListener.java model/jdo/JDOFieldImplDynamic.java
Date Sun, 17 Apr 2005 21:18:37 GMT
Author: mbo
Date: Sun Apr 17 14:18:36 2005
New Revision: 161696

URL: http://svn.apache.org/viewcvs?view=rev&rev=161696
Log:
JDOModel change: The JDOField implementation now looks up the java field and the java type
in the JavaModel during default calculation, if these values are not explicitly set on the
JDOField.

Modified:
    incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/enhancer/meta/model/EnhancerMetaDataJDOModelImpl.java
    incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java
    incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/jdo/JDOFieldImplDynamic.java

Modified: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/enhancer/meta/model/EnhancerMetaDataJDOModelImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/enhancer/meta/model/EnhancerMetaDataJDOModelImpl.java?view=diff&r1=161695&r2=161696
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/enhancer/meta/model/EnhancerMetaDataJDOModelImpl.java
(original)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/enhancer/meta/model/EnhancerMetaDataJDOModelImpl.java
Sun Apr 17 14:18:36 2005
@@ -298,10 +298,6 @@
                 affirm(field != null,
                        "cannot create JDO field: "
                        + classPath + "." + fieldName);
-                affirm(field.getPersistenceModifier()
-                       == PersistenceModifier.UNSPECIFIED,
-                       "unknown, specified JDO field: "
-                       + classPath + "." + fieldName);
             }
             field.setJavaField(javaField);
             affirm(fieldType == field.getType());

Modified: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java?view=diff&r1=161695&r2=161696
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java
(original)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java
Sun Apr 17 14:18:36 2005
@@ -165,19 +165,6 @@
                                 RuntimeJavaType declaringClass)
         throws ModelException
     {
-        // Set the persistence-modifier. A field mentioned in the runtime 
-        // metadata is a managed field. It is TRANSACTIONAL only if the 
-        // XML metadata explictily defines it as TRANSACTIONAL. 
-        // Check whether the persistence-modifier is already set which might 
-        // happen in the case the XML was read before). 
-        // If yes, leave the value as it is.
-        // If no, set it to PERSISTENT. The persistence-modifier will be 
-        // overwritten by any value explictly defined in the XML.
-        if (jdoField.getPersistenceModifier() == 
-            PersistenceModifier.UNSPECIFIED) {
-            jdoField.setPersistenceModifier(PersistenceModifier.PERSISTENT);
-        }
-        
         // handle JavaField
         JavaField javaField = declaringClass.createJavaField(jdoField, 
             javaModelFactory.getJavaType(fieldType));

Modified: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/jdo/JDOFieldImplDynamic.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/jdo/JDOFieldImplDynamic.java?view=diff&r1=161695&r2=161696
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/jdo/JDOFieldImplDynamic.java
(original)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/jdo/JDOFieldImplDynamic.java
Sun Apr 17 14:18:36 2005
@@ -252,9 +252,16 @@
      * @return the corresponding Java field representation
      */
     public JavaField getJavaField() {
-        return javaField;
+        if (javaField != null) {
+            // return java field, if explicitly set by the setter
+            return javaField;
+        }
+        
+        // not set => calculate
+        JavaType javaType = getDeclaringClass().getJavaType();
+        return javaType.getJavaField(getName());
     }
-
+    
     /**
      * Sets the corresponding Java field representation for this JDOField.
      * @param javaField the corresponding Java field representation
@@ -464,7 +471,8 @@
      * @return JavaType representation of the type of this field.
      */
     public JavaType getType() {
-        return (javaField == null) ? null : javaField.getType();
+        JavaField field = getJavaField();
+        return (field == null) ? null : field.getType();
     }
     
     /**



Mime
View raw message