You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2006/11/25 18:24:10 UTC
svn commit: r479150 - in
/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src:
main/java/org/apache/cayenne/map/compiled/
main/java/org/apache/cayenne/property/ test/java/org/apache/cayenne/property/
Author: aadamchik
Date: Sat Nov 25 09:24:09 2006
New Revision: 479150
URL: http://svn.apache.org/viewvc?view=rev&rev=479150
Log:
CAY-701: property" package refactoring
(renaming PropertyAccessorException to PropertyException)
Added:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyException.java
- copied, changed from r478936, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessException.java
Removed:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessException.java
Modified:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptor.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptorFactory.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/EnhancedPojoSingleObjectArcProperty.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptor.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptorFactory.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/ProxyClassDescriptor.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/Accessor.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseProperty.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/ClassDescriptor.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/Property.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleAttributeProperty.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/ToManyProperty.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/MockAccessor.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/compiled/DataObjectDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptor.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptor.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptor.java Sat Nov 25 09:24:09 2006
@@ -19,7 +19,7 @@
package org.apache.cayenne.map.compiled;
import org.apache.cayenne.DataObject;
-import org.apache.cayenne.property.PropertyAccessException;
+import org.apache.cayenne.property.PropertyException;
/**
* A ClassDescriptor for "generic" persistent classes implementing {@link DataObject}
@@ -33,7 +33,7 @@
// for other object types.
class DataObjectDescriptor extends PersistentDescriptor {
- public void shallowMerge(Object from, Object to) throws PropertyAccessException {
+ public void shallowMerge(Object from, Object to) throws PropertyException {
super.shallowMerge(from, to);
if (from instanceof DataObject && to instanceof DataObject) {
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptorFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptorFactory.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptorFactory.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/DataObjectDescriptorFactory.java Sat Nov 25 09:24:09 2006
@@ -28,7 +28,7 @@
import org.apache.cayenne.property.ClassDescriptorFactory;
import org.apache.cayenne.property.DataObjectAccessor;
import org.apache.cayenne.property.PersistentObjectProperty;
-import org.apache.cayenne.property.PropertyAccessException;
+import org.apache.cayenne.property.PropertyException;
import org.apache.cayenne.property.ToManyListProperty;
/**
@@ -95,7 +95,7 @@
protected Accessor createAccessor(
PersistentDescriptor descriptor,
String propertyName,
- Class propertyType) throws PropertyAccessException {
+ Class propertyType) throws PropertyException {
return new DataObjectAccessor(propertyName);
}
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/EnhancedPojoSingleObjectArcProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/EnhancedPojoSingleObjectArcProperty.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/EnhancedPojoSingleObjectArcProperty.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/EnhancedPojoSingleObjectArcProperty.java Sat Nov 25 09:24:09 2006
@@ -23,7 +23,7 @@
import org.apache.cayenne.property.AbstractSingleObjectArcProperty;
import org.apache.cayenne.property.Accessor;
import org.apache.cayenne.property.ClassDescriptor;
-import org.apache.cayenne.property.PropertyAccessException;
+import org.apache.cayenne.property.PropertyException;
/**
* A property descriptor for the to-one relationship property of an enhanced pojo. Assumes
@@ -62,7 +62,7 @@
}
}
- public Object readProperty(Object object) throws PropertyAccessException {
+ public Object readProperty(Object object) throws PropertyException {
resolveFault(object);
return super.readProperty(object);
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptor.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptor.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptor.java Sat Nov 25 09:24:09 2006
@@ -30,7 +30,7 @@
import org.apache.cayenne.property.ClassDescriptor;
import org.apache.cayenne.property.ToManyProperty;
import org.apache.cayenne.property.Property;
-import org.apache.cayenne.property.PropertyAccessException;
+import org.apache.cayenne.property.PropertyException;
import org.apache.cayenne.property.PropertyVisitor;
import org.apache.cayenne.property.ToOneProperty;
import org.apache.commons.collections.IteratorUtils;
@@ -200,7 +200,7 @@
* Invokes 'prepareForAccess' of a super descriptor and then invokes
* 'prepareForAccess' of each declared property.
*/
- public void injectValueHolders(Object object) throws PropertyAccessException {
+ public void injectValueHolders(Object object) throws PropertyException {
// do super first
if (getSuperclassDescriptor() != null) {
@@ -219,7 +219,7 @@
* super descriptor and then invokes 'shallowCopy' of each declared property.
*/
public void shallowMerge(final Object from, final Object to)
- throws PropertyAccessException {
+ throws PropertyException {
visitProperties(new PropertyVisitor() {
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptorFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptorFactory.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptorFactory.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/PersistentDescriptorFactory.java Sat Nov 25 09:24:09 2006
@@ -34,7 +34,7 @@
import org.apache.cayenne.property.FieldAccessor;
import org.apache.cayenne.property.ListProperty;
import org.apache.cayenne.property.Property;
-import org.apache.cayenne.property.PropertyAccessException;
+import org.apache.cayenne.property.PropertyException;
import org.apache.cayenne.property.SimpleAttributeProperty;
import org.apache.cayenne.property.ValueHolderProperty;
@@ -182,7 +182,7 @@
protected Accessor createAccessor(
PersistentDescriptor descriptor,
String propertyName,
- Class propertyType) throws PropertyAccessException {
+ Class propertyType) throws PropertyException {
return new FieldAccessor(descriptor.getObjectClass(), propertyName, propertyType);
}
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/ProxyClassDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/ProxyClassDescriptor.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/ProxyClassDescriptor.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/compiled/ProxyClassDescriptor.java Sat Nov 25 09:24:09 2006
@@ -23,7 +23,7 @@
import org.apache.cayenne.map.ObjEntity;
import org.apache.cayenne.property.ClassDescriptor;
import org.apache.cayenne.property.Property;
-import org.apache.cayenne.property.PropertyAccessException;
+import org.apache.cayenne.property.PropertyException;
import org.apache.cayenne.property.PropertyVisitor;
/**
@@ -98,7 +98,7 @@
return descriptor.getSuperclassDescriptor();
}
- public void injectValueHolders(Object object) throws PropertyAccessException {
+ public void injectValueHolders(Object object) throws PropertyException {
checkCompiled();
descriptor.injectValueHolders(object);
}
@@ -108,7 +108,7 @@
return descriptor.isFault(object);
}
- public void shallowMerge(Object from, Object to) throws PropertyAccessException {
+ public void shallowMerge(Object from, Object to) throws PropertyException {
checkCompiled();
descriptor.shallowMerge(from, to);
}
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -38,7 +38,7 @@
super(owner, targetDescriptor, accessor, reverseName);
}
- public Object readProperty(Object object) throws PropertyAccessException {
+ public Object readProperty(Object object) throws PropertyException {
return ensureCollectionValueHolderSet(object);
}
@@ -46,7 +46,7 @@
* Wraps list in a value holder that performs lazy faulting.
*/
public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
- throws PropertyAccessException {
+ throws PropertyException {
if (newValue instanceof Fault) {
super.writePropertyDirectly(object, null, newValue);
@@ -102,7 +102,7 @@
/**
* Injects a List in the object if it hasn't been done yet.
*/
- public void injectValueHolder(Object object) throws PropertyAccessException {
+ public void injectValueHolder(Object object) throws PropertyException {
ensureCollectionValueHolderSet(object);
}
@@ -111,7 +111,7 @@
* List if needed.
*/
protected ValueHolder ensureCollectionValueHolderSet(Object object)
- throws PropertyAccessException {
+ throws PropertyException {
Object value = accessor.getValue(object);
@@ -127,5 +127,5 @@
* Creates a Collection for an object.
*/
protected abstract ValueHolder createCollectionValueHolder(Object object)
- throws PropertyAccessException;
+ throws PropertyException;
}
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -35,8 +35,7 @@
protected ObjRelationship relationship;
public AbstractSingleObjectArcProperty(ClassDescriptor owner,
- ClassDescriptor targetDescriptor, Accessor accessor,
- String reverseName) {
+ ClassDescriptor targetDescriptor, Accessor accessor, String reverseName) {
super(owner, accessor);
this.targetDescriptor = targetDescriptor;
this.complimentaryReverseArcName = reverseName;
@@ -88,7 +87,7 @@
property.setTarget(oldTarget, null, false);
return false;
}
-
+
public boolean visitAttribute(AttributeProperty property) {
return false;
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Accessor.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=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Accessor.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Accessor.java Sat Nov 25 09:24:09 2006
@@ -38,11 +38,11 @@
/**
* Returns a property value of an object without disturbing the object fault status.
*/
- Object getValue(Object object) throws PropertyAccessException;
+ Object getValue(Object object) throws PropertyException;
/**
* Sets a property value of an object without disturbing the object fault status. Old
* value of the property is specified as a hint.
*/
- void setValue(Object object, Object newValue) throws PropertyAccessException;
+ void setValue(Object object, Object newValue) throws PropertyException;
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseProperty.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseProperty.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/BaseProperty.java Sat Nov 25 09:24:09 2006
@@ -45,12 +45,12 @@
this.name = accessor.getName();
}
- public Object readProperty(Object object) throws PropertyAccessException {
+ public Object readProperty(Object object) throws PropertyException {
return readPropertyDirectly(object);
}
public void writeProperty(Object object, Object oldValue, Object newValue)
- throws PropertyAccessException {
+ throws PropertyException {
writePropertyDirectly(object, oldValue, newValue);
}
@@ -63,16 +63,16 @@
/**
* Does nothing.
*/
- public void injectValueHolder(Object object) throws PropertyAccessException {
+ public void injectValueHolder(Object object) throws PropertyException {
// noop
}
- public Object readPropertyDirectly(Object object) throws PropertyAccessException {
+ public Object readPropertyDirectly(Object object) throws PropertyException {
return accessor.getValue(object);
}
public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
- throws PropertyAccessException {
+ throws PropertyException {
accessor.setValue(object, newValue);
}
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -57,7 +57,7 @@
this.writeMethod = descriptor.getWriteMethod();
}
catch (IntrospectionException e) {
- throw new PropertyAccessException(
+ throw new PropertyException(
"Invalid bean property: " + propertyName,
this,
e);
@@ -71,9 +71,9 @@
/**
* @since 3.0
*/
- public Object getValue(Object object) throws PropertyAccessException {
+ public Object getValue(Object object) throws PropertyException {
if (readMethod == null) {
- throw new PropertyAccessException("Property '"
+ throw new PropertyException("Property '"
+ propertyName
+ "' is not readable", this, object);
}
@@ -82,7 +82,7 @@
return readMethod.invoke(object, null);
}
catch (Throwable th) {
- throw new PropertyAccessException(
+ throw new PropertyException(
"Error reading property: " + propertyName,
this,
object,
@@ -93,10 +93,10 @@
/**
* @since 3.0
*/
- public void setValue(Object object, Object newValue) throws PropertyAccessException {
+ public void setValue(Object object, Object newValue) throws PropertyException {
if (writeMethod == null) {
- throw new PropertyAccessException("Property '"
+ throw new PropertyException("Property '"
+ propertyName
+ "' is not writable", this, object);
}
@@ -112,7 +112,7 @@
});
}
catch (Throwable th) {
- throw new PropertyAccessException(
+ throw new PropertyException(
"Error reading property: " + propertyName,
this,
object,
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ClassDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ClassDescriptor.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ClassDescriptor.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ClassDescriptor.java Sat Nov 25 09:24:09 2006
@@ -68,13 +68,13 @@
* Prepares object properties for access. This may include injection of value holders
* into the object and such.
*/
- void injectValueHolders(Object object) throws PropertyAccessException;
+ void injectValueHolders(Object object) throws PropertyException;
/**
* Merges object properties from one object to another, avoiding traversal of the
* ArcProperties.
*/
- void shallowMerge(Object from, Object to) throws PropertyAccessException;
+ void shallowMerge(Object from, Object to) throws PropertyException;
/**
* Returns a property descriptor matching property name, or null if no such 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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -47,19 +47,19 @@
* Reads the value without disturbing DataObject state. I.e. no Fault resolving occurs
* here.
*/
- public Object getValue(Object object) throws PropertyAccessException {
+ public Object getValue(Object object) throws PropertyException {
try {
DataObject dataObject = (DataObject) object;
return dataObject.readPropertyDirectly(propertyName);
}
catch (ClassCastException e) {
- throw new PropertyAccessException("Object is not a DataObject: '"
+ throw new PropertyException("Object is not a DataObject: '"
+ object.getClass().getName()
+ "'", this, object, e);
}
catch (Throwable th) {
- throw new PropertyAccessException("Error reading DataObject property: "
+ throw new PropertyException("Error reading DataObject property: "
+ propertyName, this, object, th);
}
@@ -69,18 +69,18 @@
/**
* @since 3.0
*/
- public void setValue(Object object, Object newValue) throws PropertyAccessException {
+ public void setValue(Object object, Object newValue) throws PropertyException {
try {
((DataObject) object).writePropertyDirectly(propertyName, newValue);
}
catch (ClassCastException e) {
- throw new PropertyAccessException("Object is not a DataObject: '"
+ throw new PropertyException("Object is not a DataObject: '"
+ object.getClass().getName()
+ "'", this, object, e);
}
catch (Throwable th) {
- throw new PropertyAccessException("Error reading DataObject property: "
+ throw new PropertyException("Error reading DataObject property: "
+ propertyName, this, object, th);
}
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -55,12 +55,12 @@
return propertyName;
}
- public Object getValue(Object object) throws PropertyAccessException {
+ public Object getValue(Object object) throws PropertyException {
try {
return field.get(object);
}
catch (Throwable th) {
- throw new PropertyAccessException(
+ throw new PropertyException(
"Error reading field: " + field.getName(),
this,
object,
@@ -71,7 +71,7 @@
/**
* @since 3.0
*/
- public void setValue(Object object, Object newValue) throws PropertyAccessException {
+ public void setValue(Object object, Object newValue) throws PropertyException {
// this will take care of primitives.
if (newValue == null) {
newValue = this.nullValue;
@@ -81,7 +81,7 @@
field.set(object, newValue);
}
catch (Throwable th) {
- throw new PropertyAccessException(
+ throw new PropertyException(
"Error writing field: " + field.getName(),
this,
object,
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -45,7 +45,7 @@
* Creates a List indexed on a specified property.
*/
protected ValueHolder createCollectionValueHolder(Object object)
- throws PropertyAccessException {
+ throws PropertyException {
List unordered = (List) super.createCollectionValueHolder(object);
return new IndexPropertyList(indexPropertyName, unordered, true);
}
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -41,10 +41,10 @@
* Creates a List for an object. Expects an object to be an instance of Persistent.
*/
protected ValueHolder createCollectionValueHolder(Object object)
- throws PropertyAccessException {
+ throws PropertyException {
if (!(object instanceof Persistent)) {
- throw new PropertyAccessException(
+ throw new PropertyException(
"ValueHolders for non-persistent objects are not supported.",
this,
object);
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -48,7 +48,7 @@
}
}
- public Object readProperty(Object object) throws PropertyAccessException {
+ public Object readProperty(Object object) throws PropertyException {
Object value = super.readProperty(object);
if (value instanceof Fault) {
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Property.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Property.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Property.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/Property.java Sat Nov 25 09:24:09 2006
@@ -36,12 +36,12 @@
/**
* Returns a property value of an object without disturbing the object fault status.
*/
- Object readPropertyDirectly(Object object) throws PropertyAccessException;
+ Object readPropertyDirectly(Object object) throws PropertyException;
/**
* Returns a property value, inflating unresolved object if need.
*/
- Object readProperty(Object object) throws PropertyAccessException;
+ Object readProperty(Object object) throws PropertyException;
/**
* Sets a property value of an object without disturbing the object fault status. Old
@@ -49,14 +49,14 @@
* implementor.
*/
void writePropertyDirectly(Object object, Object oldValue, Object newValue)
- throws PropertyAccessException;
+ throws PropertyException;
/**
* Sets a property value, inflating unresolved object if need. Old value of the
* property is specified as a hint and can be ignored by the property implementor.
*/
void writeProperty(Object object, Object oldValue, Object newValue)
- throws PropertyAccessException;
+ throws PropertyException;
/**
* A visitor accept method.
@@ -72,5 +72,5 @@
* unfaulted value holder and inject it into the object, if an object doesn't have it
* set yet.
*/
- void injectValueHolder(Object object) throws PropertyAccessException;
+ void injectValueHolder(Object object) throws PropertyException;
}
Copied: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyException.java (from r478936, 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/PropertyException.java?view=diff&rev=479150&p1=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyAccessException.java&r1=478936&p2=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/PropertyException.java&r2=479150
==============================================================================
--- 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/PropertyException.java Sat Nov 25 09:24:09 2006
@@ -23,55 +23,42 @@
/**
* An unchecked exception thrown on errors during property access, either within a
- * PropertyAccessor or a Property.
+ * Accessor or a Property.
*
- * @since 1.2
+ * @since 3.0
* @author Andrus Adamchik
*/
-public class PropertyAccessException extends CayenneRuntimeException {
+public class PropertyException extends CayenneRuntimeException {
protected Property property;
protected Accessor accessor;
protected Object source;
- /**
- * @since 3.0
- */
- public PropertyAccessException(String message) {
+ public PropertyException(String message) {
this(message, null);
}
- /**
- * @since 3.0
- */
- public PropertyAccessException(String message, Throwable cause) {
+ public PropertyException(String message, Throwable cause) {
super(message, cause);
}
- public PropertyAccessException(String message, Accessor accessor,
- Object source) {
+ public PropertyException(String message, Accessor accessor, Object source) {
this(message, accessor, source, null);
}
- public PropertyAccessException(String message, Accessor accessor,
- Object source, Throwable cause) {
+ public PropertyException(String message, Accessor accessor, Object source,
+ Throwable cause) {
super(message, cause);
this.accessor = accessor;
this.source = source;
}
- /**
- * @since 3.0
- */
- public PropertyAccessException(String message, Property property, Object source) {
+ public PropertyException(String message, Property property, Object source) {
this(message, property, source, null);
}
- /**
- * @since 3.0
- */
- public PropertyAccessException(String message, Property property, Object source,
+ public PropertyException(String message, Property property, Object source,
Throwable cause) {
super(message, cause);
@@ -86,9 +73,6 @@
return accessor;
}
- /**
- * @since 3.0
- */
public Property getProperty() {
return property;
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleAttributeProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleAttributeProperty.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleAttributeProperty.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/SimpleAttributeProperty.java Sat Nov 25 09:24:09 2006
@@ -46,18 +46,18 @@
return attribute;
}
- public Object readProperty(Object object) throws PropertyAccessException {
+ public Object readProperty(Object object) throws PropertyException {
resolveFault(object);
return super.readProperty(object);
}
public void writeProperty(Object object, Object oldValue, Object newValue)
- throws PropertyAccessException {
+ throws PropertyException {
resolveFault(object);
super.writeProperty(object, oldValue, newValue);
}
- void resolveFault(Object object) throws PropertyAccessException {
+ void resolveFault(Object object) throws PropertyException {
try {
Persistent persistent = (Persistent) object;
ObjectContext context = persistent.getObjectContext();
@@ -66,7 +66,7 @@
}
}
catch (ClassCastException e) {
- throw new PropertyAccessException("Object is not a Persistent: '"
+ throw new PropertyException("Object is not a Persistent: '"
+ object.getClass().getName()
+ "'", this, object, e);
}
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -38,10 +38,10 @@
}
protected ValueHolder createCollectionValueHolder(Object object)
- throws PropertyAccessException {
+ throws PropertyException {
if (!(object instanceof Persistent)) {
- throw new PropertyAccessException(
+ throw new PropertyException(
"ValueHolders for non-persistent objects are not supported.",
this,
object);
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyProperty.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyProperty.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyProperty.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/property/ToManyProperty.java Sat Nov 25 09:24:09 2006
@@ -29,8 +29,8 @@
public interface ToManyProperty extends ArcProperty {
void addTarget(Object source, Object target, boolean setReverse)
- throws PropertyAccessException;
+ throws PropertyException;
void removeTarget(Object source, Object target, boolean setReverse)
- throws PropertyAccessException;
+ throws PropertyException;
}
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -53,7 +53,7 @@
}
}
- public Object readPropertyDirectly(Object object) throws PropertyAccessException {
+ public Object readPropertyDirectly(Object object) throws PropertyException {
ValueHolder holder = (ValueHolder) accessor.getValue(object);
// TODO: Andrus, 2/9/2006 ValueHolder will resolve an object in a call to
@@ -61,12 +61,12 @@
return (holder != null) ? holder.getValueDirectly() : null;
}
- public Object readProperty(Object object) throws PropertyAccessException {
+ public Object readProperty(Object object) throws PropertyException {
return ensureValueHolderSet(object).getValue();
}
public void writePropertyDirectly(Object object, Object oldValue, Object newValue)
- throws PropertyAccessException {
+ throws PropertyException {
ValueHolder holder = (ValueHolder) accessor.getValue(object);
if (holder == null) {
@@ -78,14 +78,14 @@
}
public void writeProperty(Object object, Object oldValue, Object newValue)
- throws PropertyAccessException {
+ throws PropertyException {
ensureValueHolderSet(object).setValueDirectly(newValue);
}
/**
* Injects a ValueHolder in the object if it hasn't been done yet.
*/
- public void injectValueHolder(Object object) throws PropertyAccessException {
+ public void injectValueHolder(Object object) throws PropertyException {
ensureValueHolderSet(object);
}
@@ -94,7 +94,7 @@
* injecting a ValueHolder if needed.
*/
protected ValueHolder ensureValueHolderSet(Object object)
- throws PropertyAccessException {
+ throws PropertyException {
ValueHolder holder = (ValueHolder) accessor.getValue(object);
if (holder == null) {
@@ -109,10 +109,10 @@
* Creates a ValueHolder for an object. Default implementation requires that an object
* implements Persistent interface.
*/
- protected ValueHolder createValueHolder(Object object) throws PropertyAccessException {
+ protected ValueHolder createValueHolder(Object object) throws PropertyException {
if (!(object instanceof Persistent)) {
- throw new PropertyAccessException(
+ throw new PropertyException(
"ValueHolders for non-persistent objects are not supported.",
this,
object);
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockAccessor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockAccessor.java?view=diff&rev=479150&r1=479149&r2=479150
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockAccessor.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/property/MockAccessor.java Sat Nov 25 09:24:09 2006
@@ -24,10 +24,10 @@
return null;
}
- public Object getValue(Object object) throws PropertyAccessException {
+ public Object getValue(Object object) throws PropertyException {
return null;
}
- public void setValue(Object object, Object newValue) throws PropertyAccessException {
+ public void setValue(Object object, Object newValue) throws PropertyException {
}
}
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=479150&r1=479149&r2=479150
==============================================================================
--- 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 Sat Nov 25 09:24:09 2006
@@ -57,10 +57,10 @@
return null;
}
- public void injectValueHolders(Object object) throws PropertyAccessException {
+ public void injectValueHolders(Object object) throws PropertyException {
}
- public void shallowMerge(Object from, Object to) throws PropertyAccessException {
+ public void shallowMerge(Object from, Object to) throws PropertyException {
}
public Property getDeclaredProperty(String propertyName) {