cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r471509 - in /incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src: main/java/org/apache/cayenne/map/ main/java/org/apache/cayenne/property/ test/java/org/apache/cayenne/property/
Date Sun, 05 Nov 2006 19:50:31 GMT
Author: aadamchik
Date: Sun Nov  5 11:50:30 2006
New Revision: 471509

URL: http://svn.apache.org/viewvc?view=rev&rev=471509
Log:
CAY-701: property" package refactoring
(further separating accessor from property - renamed PropertyAccessor to just Accessor)

Added:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Accessor.java
      - copied, changed from r471441, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessor.java
Removed:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessor.java
Modified:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/ClientPersistentDescriptor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/DataObjectDescriptor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoCollectionProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoDescriptor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoSingleObjectArcProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityDescriptor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractCollectionProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractSingleObjectArcProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseClassDescriptor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BeanAccessor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/DataObjectAccessor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/FieldAccessor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/IndexedListProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ListProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PersistentObjectProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessException.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimplePersistentProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyListProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ValueHolderProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/BeanAccessorTst.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockClassDescriptor.java

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/ClientPersistentDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/ClientPersistentDescriptor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/ClientPersistentDescriptor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/ClientPersistentDescriptor.java
Sun Nov  5 11:50:30 2006
@@ -26,7 +26,7 @@
 import org.apache.cayenne.property.ClassDescriptor;
 import org.apache.cayenne.property.ListProperty;
 import org.apache.cayenne.property.Property;
-import org.apache.cayenne.property.PropertyAccessor;
+import org.apache.cayenne.property.Accessor;
 import org.apache.cayenne.property.ValueHolderProperty;
 
 /**
@@ -55,13 +55,13 @@
 
             Property property;
             if (relationship.isToMany()) {
-                PropertyAccessor accessor = makeAccessor(
+                Accessor accessor = makeAccessor(
                         relationship.getName(),
                         List.class);
                 property = new ListProperty(this, targetDescriptor, accessor, reverseName);
             }
             else {
-                PropertyAccessor accessor = makeAccessor(
+                Accessor accessor = makeAccessor(
                         relationship.getName(),
                         ValueHolder.class);
                 property = new ValueHolderProperty(

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/DataObjectDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/DataObjectDescriptor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/DataObjectDescriptor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/DataObjectDescriptor.java
Sun Nov  5 11:50:30 2006
@@ -28,7 +28,7 @@
 import org.apache.cayenne.property.PersistentObjectProperty;
 import org.apache.cayenne.property.Property;
 import org.apache.cayenne.property.PropertyAccessException;
-import org.apache.cayenne.property.PropertyAccessor;
+import org.apache.cayenne.property.Accessor;
 import org.apache.cayenne.property.ToManyListProperty;
 
 /**
@@ -67,7 +67,7 @@
             Property property;
             if (relationship.isToMany()) {
 
-                PropertyAccessor accessor = makeAccessor(
+                Accessor accessor = makeAccessor(
                         relationship.getName(),
                         List.class);
 
@@ -79,7 +79,7 @@
             }
             else {
                 ObjEntity targetEntity = (ObjEntity) relationship.getTargetEntity();
-                PropertyAccessor accessor = makeAccessor(
+                Accessor accessor = makeAccessor(
                         relationship.getName(),
                         targetEntity.getJavaClass());
                 property = new PersistentObjectProperty(
@@ -93,7 +93,7 @@
         }
     }
 
-    protected PropertyAccessor makeAccessor(String propertyName, Class propertyType)
+    protected Accessor makeAccessor(String propertyName, Class propertyType)
             throws PropertyAccessException {
         return new DataObjectAccessor(propertyName);
     }

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoCollectionProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoCollectionProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoCollectionProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoCollectionProperty.java
Sun Nov  5 11:50:30 2006
@@ -20,7 +20,7 @@
 
 import org.apache.cayenne.property.ClassDescriptor;
 import org.apache.cayenne.property.ListProperty;
-import org.apache.cayenne.property.PropertyAccessor;
+import org.apache.cayenne.property.Accessor;
 
 /**
  * @since 3.0
@@ -28,19 +28,16 @@
  */
 class EnhancedPojoCollectionProperty extends ListProperty {
 
-    private PropertyAccessor faultResolvedFlagAccessor;
+    private Accessor faultResolvedFlagAccessor;
 
     public EnhancedPojoCollectionProperty(ClassDescriptor owner,
-            ClassDescriptor targetDescriptor, PropertyAccessor accessor,
-            String reverseName, PropertyAccessor faultResolvedFlagAccessor) {
+            ClassDescriptor targetDescriptor, Accessor accessor, String reverseName,
+            Accessor faultResolvedFlagAccessor) {
         super(owner, targetDescriptor, accessor, reverseName);
         this.faultResolvedFlagAccessor = faultResolvedFlagAccessor;
     }
 
     public void invalidate(Object object) {
-        faultResolvedFlagAccessor.writePropertyDirectly(
-                object,
-                Boolean.TRUE,
-                Boolean.FALSE);
+        faultResolvedFlagAccessor.setValue(object, Boolean.FALSE);
     }
 }

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoDescriptor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoDescriptor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoDescriptor.java
Sun Nov  5 11:50:30 2006
@@ -25,7 +25,7 @@
 import org.apache.cayenne.property.ClassDescriptor;
 import org.apache.cayenne.property.FieldAccessor;
 import org.apache.cayenne.property.Property;
-import org.apache.cayenne.property.PropertyAccessor;
+import org.apache.cayenne.property.Accessor;
 
 /**
  * A descriptor for enhanced POJO's. Used in conjunction with Cayenne class enhancer.
@@ -52,13 +52,13 @@
                     .getTargetEntityName());
             String reverseName = relationship.getReverseRelationshipName();
 
-            PropertyAccessor faultFlagAccessor = makeFaultFlagAccessor(relationship
+            Accessor faultFlagAccessor = makeFaultFlagAccessor(relationship
                     .getName());
 
             Property property;
             if (relationship.isToMany()) {
                 // TODO: andrus, 10/13/2006 - unfinished...
-                PropertyAccessor accessor = makeAccessor(
+                Accessor accessor = makeAccessor(
                         relationship.getName(),
                         List.class);
                 property = new EnhancedPojoCollectionProperty(
@@ -69,7 +69,7 @@
                         faultFlagAccessor);
             }
             else {
-                PropertyAccessor accessor = makeAccessor(
+                Accessor accessor = makeAccessor(
                         relationship.getName(),
                         targetDescriptor.getObjectClass());
                 property = new EnhancedPojoSingleObjectArcProperty(
@@ -84,7 +84,7 @@
         }
     }
 
-    PropertyAccessor makeFaultFlagAccessor(String propertyName) {
+    Accessor makeFaultFlagAccessor(String propertyName) {
         return new FieldAccessor(
                 getObjectClass(),
                 FAULT_FIELD_PREFIX + propertyName,

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoSingleObjectArcProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoSingleObjectArcProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoSingleObjectArcProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EnhancedPojoSingleObjectArcProperty.java
Sun Nov  5 11:50:30 2006
@@ -23,7 +23,7 @@
 import org.apache.cayenne.property.AbstractSingleObjectArcProperty;
 import org.apache.cayenne.property.ClassDescriptor;
 import org.apache.cayenne.property.PropertyAccessException;
-import org.apache.cayenne.property.PropertyAccessor;
+import org.apache.cayenne.property.Accessor;
 
 /**
  * A property descriptor for the to-one relationship property of an enhanced pojo. Assumes
@@ -35,25 +35,21 @@
  */
 class EnhancedPojoSingleObjectArcProperty extends AbstractSingleObjectArcProperty {
 
-    protected PropertyAccessor faultResolvedFlagAccessor;
+    protected Accessor faultResolvedFlagAccessor;
 
     EnhancedPojoSingleObjectArcProperty(ClassDescriptor owner,
-            ClassDescriptor targetDescriptor, PropertyAccessor accessor,
-            String reverseName, PropertyAccessor faultResolvedFlagAccessor) {
+            ClassDescriptor targetDescriptor, Accessor accessor, String reverseName,
+            Accessor faultResolvedFlagAccessor) {
         super(owner, targetDescriptor, accessor, reverseName);
         this.faultResolvedFlagAccessor = faultResolvedFlagAccessor;
     }
 
     public boolean isFault(Object source) {
-        return !((Boolean) faultResolvedFlagAccessor.readPropertyDirectly(source))
-                .booleanValue();
+        return !((Boolean) faultResolvedFlagAccessor.getValue(source)).booleanValue();
     }
 
     public void invalidate(Object object) {
-        faultResolvedFlagAccessor.writePropertyDirectly(
-                object,
-                Boolean.TRUE,
-                Boolean.FALSE);
+        faultResolvedFlagAccessor.setValue(object, Boolean.FALSE);
     }
 
     protected void resolveFault(Object object) {
@@ -62,10 +58,7 @@
                     (Persistent) object,
                     getName());
             writePropertyDirectly(object, null, target);
-            faultResolvedFlagAccessor.writePropertyDirectly(
-                    object,
-                    Boolean.FALSE,
-                    Boolean.TRUE);
+            faultResolvedFlagAccessor.setValue(object, Boolean.TRUE);
         }
     }
 

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityDescriptor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityDescriptor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityDescriptor.java
Sun Nov  5 11:50:30 2006
@@ -34,7 +34,7 @@
 import org.apache.cayenne.property.ListProperty;
 import org.apache.cayenne.property.Property;
 import org.apache.cayenne.property.PropertyAccessException;
-import org.apache.cayenne.property.PropertyAccessor;
+import org.apache.cayenne.property.Accessor;
 import org.apache.cayenne.property.SimplePersistentProperty;
 import org.apache.commons.lang.builder.ToStringBuilder;
 
@@ -158,7 +158,7 @@
             ObjAttribute attribute = (ObjAttribute) it.next();
 
             Class propertyType = attribute.getJavaClass();
-            PropertyAccessor accessor = makeAccessor(attribute.getName(), propertyType);
+            Accessor accessor = makeAccessor(attribute.getName(), propertyType);
             allDescriptors.put(attribute.getName(), new SimplePersistentProperty(
                     this,
                     accessor,
@@ -184,13 +184,13 @@
 
             Property property;
             if (relationship.isToMany()) {
-                PropertyAccessor accessor = makeAccessor(
+                Accessor accessor = makeAccessor(
                         relationship.getName(),
                         List.class);
                 property = new ListProperty(this, targetDescriptor, accessor, reverseName);
             }
             else {
-                PropertyAccessor accessor = makeAccessor(
+                Accessor accessor = makeAccessor(
                         relationship.getName(),
                         targetDescriptor.getObjectClass());
                 property = new AbstractSingleObjectArcProperty(
@@ -219,7 +219,7 @@
      * {@link DataObjectAccessor} for DataObjects and {@link FieldAccessor} for all other
      * classes.
      */
-    protected PropertyAccessor makeAccessor(String propertyName, Class propertyType)
+    protected Accessor makeAccessor(String propertyName, Class propertyType)
             throws PropertyAccessException {
 
         try {

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractCollectionProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractCollectionProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractCollectionProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractCollectionProperty.java
Sun Nov  5 11:50:30 2006
@@ -34,7 +34,7 @@
         implements CollectionProperty {
 
     public AbstractCollectionProperty(ClassDescriptor owner,
-            ClassDescriptor targetDescriptor, PropertyAccessor accessor,
+            ClassDescriptor targetDescriptor, Accessor accessor,
             String reverseName) {
         super(owner, targetDescriptor, accessor, reverseName);
     }
@@ -118,11 +118,11 @@
     protected ValueHolder ensureCollectionValueHolderSet(Object object)
             throws PropertyAccessException {
 
-        Object value = accessor.readPropertyDirectly(object);
+        Object value = accessor.getValue(object);
 
         if (value == null || value instanceof Fault) {
             value = createCollectionValueHolder(object);
-            accessor.writePropertyDirectly(object, null, value);
+            accessor.setValue(object, value);
         }
 
         return (ValueHolder) value;

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractSingleObjectArcProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractSingleObjectArcProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractSingleObjectArcProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/AbstractSingleObjectArcProperty.java
Sun Nov  5 11:50:30 2006
@@ -35,7 +35,7 @@
     protected ObjRelationship relationship;
 
     public AbstractSingleObjectArcProperty(ClassDescriptor owner,
-            ClassDescriptor targetDescriptor, PropertyAccessor accessor,
+            ClassDescriptor targetDescriptor, Accessor accessor,
             String reverseName) {
         super(owner, accessor);
         this.targetDescriptor = targetDescriptor;

Copied: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Accessor.java
(from r471441, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessor.java)
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Accessor.java?view=diff&rev=471509&p1=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessor.java&r1=471441&p2=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Accessor.java&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Accessor.java
Sun Nov  5 11:50:30 2006
@@ -23,12 +23,12 @@
 
 /**
  * An accessor of a property value. Abstracts the actual property implementation. E.g. it
- * can be a Field, a pair of get/set methods or a DataObject.
+ * can be a Field, a pair of get/set methods or a map/DataObject.
  * 
- * @since 1.2
+ * @since 3.0
  * @author Andrus Adamchik
  */
-public interface PropertyAccessor extends Serializable {
+public interface Accessor extends Serializable {
 
     /**
      * Returns property name.
@@ -38,12 +38,11 @@
     /**
      * Returns a property value of an object without disturbing the object fault status.
      */
-    Object readPropertyDirectly(Object object) throws PropertyAccessException;
+    Object getValue(Object object) throws PropertyAccessException;
 
     /**
      * Sets a property value of an object without disturbing the object fault status. Old
      * value of the property is specified as a hint.
      */
-    void writePropertyDirectly(Object object, Object oldValue, Object newValue)
-            throws PropertyAccessException;
+    void setValue(Object object, Object newValue) throws PropertyAccessException;
 }

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseClassDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseClassDescriptor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseClassDescriptor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseClassDescriptor.java
Sun Nov  5 11:50:30 2006
@@ -46,7 +46,7 @@
     protected Map declaredProperties;
     protected Map valueHolderProperties;
     protected Map subclassDescriptors;
-    protected PropertyAccessor persistenceStateProperty;
+    protected Accessor persistenceStateProperty;
 
     /**
      * Creates an uncompiled BaseClassDescriptor. Subclasses may add a call to "compile"
@@ -65,7 +65,7 @@
             return false;
         }
 
-        return HOLLOW_STATE.equals(persistenceStateProperty.readPropertyDirectly(object));
+        return HOLLOW_STATE.equals(persistenceStateProperty.getValue(object));
     }
 
     /**

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BeanAccessor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BeanAccessor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BeanAccessor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BeanAccessor.java
Sun Nov  5 11:50:30 2006
@@ -29,7 +29,7 @@
  * @since 1.2
  * @author Andrus Adamchik
  */
-public class BeanAccessor implements PropertyAccessor {
+public class BeanAccessor implements Accessor {
 
     protected String propertyName;
     protected Method readMethod;
@@ -68,7 +68,10 @@
         return propertyName;
     }
 
-    public Object readPropertyDirectly(Object object) throws PropertyAccessException {
+    /**
+     * @since 3.0
+     */
+    public Object getValue(Object object) throws PropertyAccessException {
         if (readMethod == null) {
             throw new PropertyAccessException("Property '"
                     + propertyName
@@ -87,8 +90,10 @@
         }
     }
 
-    public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
-            throws PropertyAccessException {
+    /**
+     * @since 3.0
+     */
+    public void setValue(Object object, Object newValue) throws PropertyAccessException {
 
         if (writeMethod == null) {
             throw new PropertyAccessException("Property '"

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/DataObjectAccessor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/DataObjectAccessor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/DataObjectAccessor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/DataObjectAccessor.java
Sun Nov  5 11:50:30 2006
@@ -26,7 +26,7 @@
  * 
  * @author Andrus Adamchik
  */
-public class DataObjectAccessor implements PropertyAccessor {
+public class DataObjectAccessor implements Accessor {
 
     protected String propertyName;
 
@@ -47,7 +47,7 @@
      * Reads the value without disturbing DataObject state. I.e. no Fault resolving occurs
      * here.
      */
-    public Object readPropertyDirectly(Object object) throws PropertyAccessException {
+    public Object getValue(Object object) throws PropertyAccessException {
         try {
 
             DataObject dataObject = (DataObject) object;
@@ -63,11 +63,13 @@
                     + propertyName, this, object, th);
         }
 
-        // TODO - see TODO in 'writeValue'
+        // TODO - see TODO in 'setValue'
     }
 
-    public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
-            throws PropertyAccessException {
+    /**
+     * @since 3.0
+     */
+    public void setValue(Object object, Object newValue) throws PropertyAccessException {
 
         try {
             ((DataObject) object).writePropertyDirectly(propertyName, newValue);

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/FieldAccessor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/FieldAccessor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/FieldAccessor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/FieldAccessor.java
Sun Nov  5 11:50:30 2006
@@ -30,7 +30,7 @@
  * @since 1.2
  * @author Andrus Adamchik
  */
-public class FieldAccessor implements PropertyAccessor {
+public class FieldAccessor implements Accessor {
 
     protected String propertyName;
     protected Field field;
@@ -55,7 +55,7 @@
         return propertyName;
     }
 
-    public Object readPropertyDirectly(Object object) throws PropertyAccessException {
+    public Object getValue(Object object) throws PropertyAccessException {
         try {
             return field.get(object);
         }
@@ -68,8 +68,10 @@
         }
     }
 
-    public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
-            throws PropertyAccessException {
+    /**
+     * @since 3.0
+     */
+    public void setValue(Object object, Object newValue) throws PropertyAccessException {
         // this will take care of primitives.
         if (newValue == null) {
             newValue = this.nullValue;

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/IndexedListProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/IndexedListProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/IndexedListProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/IndexedListProperty.java
Sun Nov  5 11:50:30 2006
@@ -35,7 +35,7 @@
     protected String indexPropertyName;
 
     public IndexedListProperty(ClassDescriptor owner, ClassDescriptor targetDescriptor,
-            PropertyAccessor accessor, String reverseName, String indexPropertyName) {
+            Accessor accessor, String reverseName, String indexPropertyName) {
 
         super(owner, targetDescriptor, accessor, reverseName);
         this.indexPropertyName = indexPropertyName;

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ListProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ListProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ListProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ListProperty.java
Sun Nov  5 11:50:30 2006
@@ -33,7 +33,7 @@
 public class ListProperty extends AbstractCollectionProperty {
 
     public ListProperty(ClassDescriptor owner, ClassDescriptor targetDescriptor,
-            PropertyAccessor accessor, String reverseName) {
+            Accessor accessor, String reverseName) {
         super(owner, targetDescriptor, accessor, reverseName);
     }
 
@@ -54,7 +54,7 @@
     }
 
     public boolean isFault(Object object) {
-        Object target = accessor.readPropertyDirectly(object);
+        Object target = accessor.getValue(object);
         return target == null
                 || target instanceof Fault
                 || ((ValueHolder) target).isFault();

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PersistentObjectProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PersistentObjectProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PersistentObjectProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PersistentObjectProperty.java
Sun Nov  5 11:50:30 2006
@@ -31,21 +31,21 @@
 public class PersistentObjectProperty extends AbstractSingleObjectArcProperty {
 
     public PersistentObjectProperty(ClassDescriptor owner,
-            ClassDescriptor targetDescriptor, PropertyAccessor accessor,
+            ClassDescriptor targetDescriptor, Accessor accessor,
             String reverseName) {
         super(owner, targetDescriptor, accessor, reverseName);
     }
 
     public boolean isFault(Object object) {
-        Object target = accessor.readPropertyDirectly(object);
+        Object target = accessor.getValue(object);
         return target instanceof Fault;
     }
     
     public void invalidate(Object object) {
-        Object target = accessor.readPropertyDirectly(object);
+        Object target = accessor.getValue(object);
         
         if(!(target instanceof Fault)) {
-            accessor.writePropertyDirectly(object, target, Fault.getToOneFault());
+            accessor.setValue(object, Fault.getToOneFault());
         }
     }
 
@@ -68,13 +68,13 @@
      */
     public void shallowMerge(Object from, Object to) throws PropertyAccessException {
 
-        Object fromValue = accessor.readPropertyDirectly(from);
+        Object fromValue = accessor.getValue(from);
 
         if (fromValue == null) {
-            writePropertyDirectly(to, accessor.readPropertyDirectly(to), null);
+            writePropertyDirectly(to, accessor.getValue(to), null);
         }
         else {
-            writePropertyDirectly(to, accessor.readPropertyDirectly(to), Fault
+            writePropertyDirectly(to, accessor.getValue(to), Fault
                     .getToOneFault());
         }
     }

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessException.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessException.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessException.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessException.java
Sun Nov  5 11:50:30 2006
@@ -31,7 +31,7 @@
 public class PropertyAccessException extends CayenneRuntimeException {
 
     protected Property property;
-    protected PropertyAccessor accessor;
+    protected Accessor accessor;
     protected Object source;
 
     /**
@@ -48,12 +48,12 @@
         super(message, cause);
     }
 
-    public PropertyAccessException(String message, PropertyAccessor accessor,
+    public PropertyAccessException(String message, Accessor accessor,
             Object source) {
         this(message, accessor, source, null);
     }
 
-    public PropertyAccessException(String message, PropertyAccessor accessor,
+    public PropertyAccessException(String message, Accessor accessor,
             Object source, Throwable cause) {
         super(message, cause);
 
@@ -82,7 +82,7 @@
     /**
      * Returns property descriptor that was used to access the property. It may be null.
      */
-    public PropertyAccessor getAccessor() {
+    public Accessor getAccessor() {
         return accessor;
     }
 

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimplePersistentProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimplePersistentProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimplePersistentProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimplePersistentProperty.java
Sun Nov  5 11:50:30 2006
@@ -30,7 +30,7 @@
 
     private ObjAttribute attribute;
 
-    public SimplePersistentProperty(ClassDescriptor owner, PropertyAccessor accessor,
+    public SimplePersistentProperty(ClassDescriptor owner, Accessor accessor,
             ObjAttribute attribute) {
         super(owner, accessor);
         this.attribute = attribute;

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleProperty.java
Sun Nov  5 11:50:30 2006
@@ -29,12 +29,12 @@
 public class SimpleProperty implements Property {
 
     protected ClassDescriptor owner;
-    protected PropertyAccessor accessor;
+    protected Accessor accessor;
 
     // name is derived from accessor, cached here for performance
     final String name;
 
-    public SimpleProperty(ClassDescriptor owner, PropertyAccessor accessor) {
+    public SimpleProperty(ClassDescriptor owner, Accessor accessor) {
 
         if (accessor == null) {
             throw new IllegalArgumentException("Null accessor");
@@ -70,17 +70,17 @@
     }
 
     public void shallowMerge(Object from, Object to) throws PropertyAccessException {
-        writePropertyDirectly(to, accessor.readPropertyDirectly(to), accessor
-                .readPropertyDirectly(from));
+        writePropertyDirectly(to, accessor.getValue(to), accessor
+                .getValue(from));
     }
 
     public Object readPropertyDirectly(Object object) throws PropertyAccessException {
-        return accessor.readPropertyDirectly(object);
+        return accessor.getValue(object);
     }
 
     public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
             throws PropertyAccessException {
-        accessor.writePropertyDirectly(object, oldValue, newValue);
+        accessor.setValue(object, newValue);
     }
 
     public String toString() {

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyListProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyListProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyListProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyListProperty.java
Sun Nov  5 11:50:30 2006
@@ -33,7 +33,7 @@
 public class ToManyListProperty extends ListProperty {
 
     public ToManyListProperty(ClassDescriptor owner, ClassDescriptor targetDescriptor,
-            PropertyAccessor accessor, String reverseName) {
+            Accessor accessor, String reverseName) {
         super(owner, targetDescriptor, accessor, reverseName);
     }
 

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ValueHolderProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ValueHolderProperty.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ValueHolderProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ValueHolderProperty.java
Sun Nov  5 11:50:30 2006
@@ -34,7 +34,7 @@
 public class ValueHolderProperty extends AbstractSingleObjectArcProperty {
 
     public ValueHolderProperty(ClassDescriptor owner, ClassDescriptor targetDescriptor,
-            PropertyAccessor accessor, String reverseName) {
+            Accessor accessor, String reverseName) {
         super(owner, targetDescriptor, accessor, reverseName);
     }
 
@@ -42,19 +42,19 @@
      * Returns true if a property ValueHolder is not initialized or is itself a fault.
      */
     public boolean isFault(Object object) {
-        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(object);
+        ValueHolder holder = (ValueHolder) accessor.getValue(object);
         return holder == null || holder.isFault();
     }
 
     public void invalidate(Object object) {
-        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(object);
+        ValueHolder holder = (ValueHolder) accessor.getValue(object);
         if (holder != null && !holder.isFault()) {
             holder.invalidate();
         }
     }
 
     public Object readPropertyDirectly(Object object) throws PropertyAccessException {
-        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(object);
+        ValueHolder holder = (ValueHolder) accessor.getValue(object);
 
         // TODO: Andrus, 2/9/2006 ValueHolder will resolve an object in a call to
         // 'getValue'; this is inconsistent with 'readPropertyDirectly' contract
@@ -68,10 +68,10 @@
     public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
             throws PropertyAccessException {
 
-        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(object);
+        ValueHolder holder = (ValueHolder) accessor.getValue(object);
         if (holder == null) {
             holder = createValueHolder(object);
-            accessor.writePropertyDirectly(object, null, holder);
+            accessor.setValue(object, holder);
         }
 
         holder.setValueDirectly(newValue);
@@ -100,10 +100,10 @@
     protected ValueHolder ensureValueHolderSet(Object object)
             throws PropertyAccessException {
 
-        ValueHolder holder = (ValueHolder) accessor.readPropertyDirectly(object);
+        ValueHolder holder = (ValueHolder) accessor.getValue(object);
         if (holder == null) {
             holder = createValueHolder(object);
-            accessor.writePropertyDirectly(object, null, holder);
+            accessor.setValue(object, holder);
         }
 
         return holder;

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/BeanAccessorTst.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/BeanAccessorTst.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/BeanAccessorTst.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/BeanAccessorTst.java
Sun Nov  5 11:50:30 2006
@@ -36,9 +36,9 @@
         TestJavaBean o1 = new TestJavaBean();
 
         assertNull(o1.getByteArrayField());
-        accessor.writePropertyDirectly(o1, null, bytes);
+        accessor.setValue(o1, bytes);
         assertSame(bytes, o1.getByteArrayField());
-        assertSame(bytes, accessor.readPropertyDirectly(o1));
+        assertSame(bytes, accessor.getValue(o1));
     }
 
     public void testStringProperty() {
@@ -51,9 +51,9 @@
         TestJavaBean o1 = new TestJavaBean();
 
         assertNull(o1.getStringField());
-        accessor.writePropertyDirectly(o1, null, "ABC");
+        accessor.setValue(o1, "ABC");
         assertSame("ABC", o1.getStringField());
-        assertSame("ABC", accessor.readPropertyDirectly(o1));
+        assertSame("ABC", accessor.getValue(o1));
     }
 
     public void testIntProperty() {
@@ -66,11 +66,11 @@
         TestJavaBean o1 = new TestJavaBean();
 
         assertEquals(0, o1.getIntField());
-        accessor.writePropertyDirectly(o1, null, new Integer(5));
+        accessor.setValue(o1, new Integer(5));
         assertEquals(5, o1.getIntField());
-        assertEquals(new Integer(5), accessor.readPropertyDirectly(o1));
+        assertEquals(new Integer(5), accessor.getValue(o1));
 
-        accessor.writePropertyDirectly(o1, null, null);
+        accessor.setValue(o1, null);
         assertEquals("Incorrectly set null default", 0, o1.getIntField());
     }
 

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockClassDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockClassDescriptor.java?view=diff&rev=471509&r1=471508&r2=471509
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockClassDescriptor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockClassDescriptor.java
Sun Nov  5 11:50:30 2006
@@ -45,15 +45,15 @@
         return this;
     }
 
-    public PropertyAccessor getObjectContextProperty() {
+    public Accessor getObjectContextProperty() {
         return null;
     }
 
-    public PropertyAccessor getObjectIdProperty() {
+    public Accessor getObjectIdProperty() {
         return null;
     }
 
-    public PropertyAccessor getPersistenceStateProperty() {
+    public Accessor getPersistenceStateProperty() {
         return null;
     }
 



Mime
View raw message