1 21 package oracle.toplink.essentials.descriptors.copying; 23 24 import oracle.toplink.essentials.exceptions.*; 25 import oracle.toplink.essentials.sessions.*; 26 import oracle.toplink.essentials.descriptors.ClassDescriptor; 27 import oracle.toplink.essentials.queryframework.ObjectLevelReadQuery; 28 import oracle.toplink.essentials.queryframework.ObjectBuildingQuery; 29 30 36 public abstract class AbstractCopyPolicy implements CopyPolicy { 37 protected ClassDescriptor descriptor; 38 39 public AbstractCopyPolicy() { 40 super(); 41 } 42 43 public abstract Object buildClone(Object domainObject, Session session) throws DescriptorException; 44 45 48 public Object buildWorkingCopyClone(Object domainObject, Session session) throws DescriptorException { 49 return buildClone(domainObject, session); 50 } 51 52 55 public Object buildWorkingCopyCloneFromRow(Record row, ObjectLevelReadQuery query) throws DescriptorException { 56 return this.buildWorkingCopyCloneFromRow(row, (ObjectBuildingQuery)query); 57 } 58 59 62 public Object buildWorkingCopyCloneFromRow(Record row, ObjectBuildingQuery query) throws DescriptorException { 63 return getDescriptor().getObjectBuilder().buildNewInstance(); 64 } 65 66 70 public Object clone() { 71 try { 72 return super.clone(); 74 } catch (Exception exception) { 75 } 76 return null; 77 } 78 79 82 protected ClassDescriptor getDescriptor() { 83 return descriptor; 84 } 85 86 89 public void initialize(Session session) throws DescriptorException { 90 } 92 93 96 public void setDescriptor(ClassDescriptor descriptor) { 97 this.descriptor = descriptor; 98 } 99 100 103 public abstract boolean buildsNewInstance(); 104 } 105 | Popular Tags |