1 19 20 package org.apache.cayenne.jpa.reflect; 21 22 import org.apache.cayenne.Fault; 23 import org.apache.cayenne.Persistent; 24 import org.apache.cayenne.reflect.FieldAccessor; 25 import org.apache.cayenne.reflect.PropertyException; 26 27 class JpaCollectionFieldAccessor extends FieldAccessor { 28 29 public JpaCollectionFieldAccessor(Class objectClass, String propertyName, 30 Class propertyType) { 31 super(objectClass, propertyName, propertyType); 32 33 if (!Persistent.class.isAssignableFrom(objectClass)) { 34 throw new IllegalArgumentException ("Only supports persistent classes. Got: " 35 + objectClass); 36 } 37 } 38 39 42 @Override 43 public void setValue(Object object, Object newValue) throws PropertyException { 44 45 if (newValue instanceof Fault) { 46 newValue = ((Fault) newValue).resolveFault((Persistent) object, getName()); 47 } 48 49 super.setValue(object, newValue); 50 } 51 } 52 | Popular Tags |