Changes between Version 10 and Version 11 of PRO_LIB_UTILS_R0
- Timestamp:
- 12/10/08 13:54:42 (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PRO_LIB_UTILS_R0
v10 v11 25 25 26 26 = Design = 27 * Assign 27 * Assign - public static <T extends !ProObject> void assign(T dest, T source) 28 The assign() method should copy the values of all properties of the source !ProObject to the destionation !ProObject. It should be a "smart" copy, so for each property should be decided how to be copied. 29 30 Implementation can just call a private assign() method that works for a particular property and can decide how to copy it. 31 32 * Clone - public static <T extends !ProObject> T clone(T src) 33 The clone() method should make a new !ProObject instance which is a copy of the original object. The properties in the new instance have their values assigned from the original object. 34 35 Implementation can just make a new !ProObject instance and then call the assign() method to copy all property values from the original to the new instance. 36 37 * Single property assign - private static <T extends !ProObject> void assign(!ProObject dest, !ProObject source, String propId) 28 38 The assign() method should take care about property types and annotations to decide what to do when trying to copy data. Here are all the cases: 29 39 ||property types||relation/annotation||value class||value action||comment|| … … 46 56 ||!AutoListProperty || --> || --> ||none ||do nothing|| 47 57 48 Implementation should just add these cases to the assign() method in the !ProUtil class. 49 50 * Cloning 51 The clone() method should make a new !ProObject instance which is a copy of the original object. The properties in the new instance are assigned their values via the assign() method. 58 * New annotation - @Shared 59 A new annotation should be created. This annotation is for the smart copying of objects. If a property is marked as @Shared, this means that the value it holds should be the same for all objects using this property. In other words, when copying such property the new property should hold a reference to the value, not a clone of the value. 52 60 53 61 * Tests 54 org.sophie2.core.prolib.util. ProUtilTest.java62 org.sophie2.core.prolib.util.!ProUtilTest 55 63 56 64 = Implementation =