cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r479158 - in /incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src: main/java/org/apache/cayenne/reflect/ test/java/org/apache/cayenne/map/
Date Sat, 25 Nov 2006 18:11:29 GMT
Author: aadamchik
Date: Sat Nov 25 10:11:28 2006
New Revision: 479158

URL: http://svn.apache.org/viewvc?view=rev&rev=479158
Log:
CAY-701: "property" package refactoring
(renaming proxy descriptor to LazyClassDescriptorDecorator)

Added:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
      - copied, changed from r479157, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ProxyClassDescriptor.java
Removed:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ProxyClassDescriptor.java
Modified:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ClassDescriptorMap.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/map/EntityResolverClassDescriptorTst.java

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ClassDescriptorMap.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ClassDescriptorMap.java?view=diff&rev=479158&r1=479157&r2=479158
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ClassDescriptorMap.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ClassDescriptorMap.java
Sat Nov 25 10:11:28 2006
@@ -103,7 +103,7 @@
      * descriptors that are not compiled yet.
      */
     protected ClassDescriptor createProxyDescriptor(String entityName) {
-        ClassDescriptor descriptor = new ProxyClassDescriptor(this, entityName);
+        ClassDescriptor descriptor = new LazyClassDescriptorDecorator(this, entityName);
         addDescriptor(entityName, descriptor);
         return descriptor;
     }

Copied: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
(from r479157, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ProxyClassDescriptor.java)
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java?view=diff&rev=479158&p1=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ProxyClassDescriptor.java&r1=479157&p2=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java&r2=479158
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ProxyClassDescriptor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/LazyClassDescriptorDecorator.java
Sat Nov 25 10:11:28 2006
@@ -23,23 +23,28 @@
 import org.apache.cayenne.map.ObjEntity;
 
 /**
- * A ClassDescriptor wrapper that compiles itself lazily on first access.
+ * A ClassDescriptor wrapper that compiles decoarated descriptor lazily on first access.
  * 
  * @since 3.0
  * @author Andrus Adamchik
  */
-public class ProxyClassDescriptor implements ClassDescriptor {
+public class LazyClassDescriptorDecorator implements ClassDescriptor {
 
     protected ClassDescriptor descriptor;
     protected ClassDescriptorMap descriptorMap;
     protected String entityName;
 
-    public ProxyClassDescriptor(ClassDescriptorMap descriptorMap, String entityName) {
+    public LazyClassDescriptorDecorator(ClassDescriptorMap descriptorMap,
+            String entityName) {
         this.descriptorMap = descriptorMap;
         this.entityName = entityName;
     }
 
-    protected void checkCompiled() {
+    /**
+     * Checks whether decorated descriptor is initialized, and if not, creates it using
+     * parent {@link ClassDescriptorMap}.
+     */
+    protected void checkDescriptorInitialized() {
         if (descriptor == null) {
             descriptor = descriptorMap.createDescriptor(entityName);
         }
@@ -50,67 +55,67 @@
      * needed.
      */
     public ClassDescriptor getDescriptor() {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor;
     }
 
     public Object createObject() {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.createObject();
     }
 
     public Property getDeclaredProperty(String propertyName) {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.getDeclaredProperty(propertyName);
     }
 
     public ObjEntity getEntity() {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.getEntity();
     }
 
     public Class getObjectClass() {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.getObjectClass();
     }
 
     public Iterator getProperties() {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.getProperties();
     }
 
     public Property getProperty(String propertyName) {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.getProperty(propertyName);
     }
 
     public ClassDescriptor getSubclassDescriptor(Class objectClass) {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.getSubclassDescriptor(objectClass);
     }
 
     public ClassDescriptor getSuperclassDescriptor() {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.getSuperclassDescriptor();
     }
 
     public void injectValueHolders(Object object) throws PropertyException {
-        checkCompiled();
+        checkDescriptorInitialized();
         descriptor.injectValueHolders(object);
     }
 
     public boolean isFault(Object object) {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.isFault(object);
     }
 
     public void shallowMerge(Object from, Object to) throws PropertyException {
-        checkCompiled();
+        checkDescriptorInitialized();
         descriptor.shallowMerge(from, to);
     }
 
     public boolean visitProperties(PropertyVisitor visitor) {
-        checkCompiled();
+        checkDescriptorInitialized();
         return descriptor.visitProperties(visitor);
     }
 }

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/map/EntityResolverClassDescriptorTst.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/map/EntityResolverClassDescriptorTst.java?view=diff&rev=479158&r1=479157&r2=479158
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/map/EntityResolverClassDescriptorTst.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/map/EntityResolverClassDescriptorTst.java
Sat Nov 25 10:11:28 2006
@@ -24,7 +24,7 @@
 import org.apache.cayenne.reflect.MockClassDescriptor;
 import org.apache.cayenne.reflect.MockClassDescriptorFactory;
 import org.apache.cayenne.reflect.Property;
-import org.apache.cayenne.reflect.ProxyClassDescriptor;
+import org.apache.cayenne.reflect.LazyClassDescriptorDecorator;
 import org.apache.cayenne.testdo.mt.MtTable1;
 import org.apache.cayenne.testdo.mt.MtTable2;
 import org.apache.cayenne.unit.AccessStack;
@@ -67,7 +67,7 @@
         try {
             ClassDescriptor descriptor = resolver.getClassDescriptor("MtTable1");
             assertNotNull(descriptor);
-            descriptor = ((ProxyClassDescriptor) descriptor).getDescriptor();
+            descriptor = ((LazyClassDescriptorDecorator) descriptor).getDescriptor();
             assertSame(mockDescriptor, descriptor);
         }
         finally {



Mime
View raw message