View Javadoc
1 /* 2 * Created on 09.03.2004 3 */ 4 package org.xpcards.model; 5 6 import java.beans.BeanInfo; 7 import java.beans.Encoder; 8 import java.beans.Introspector; 9 import java.beans.PropertyDescriptor; 10 import java.util.Enumeration; 11 12 /*** 13 * @author galu02 14 */ 15 public class IterationPersistenceDelegate extends BasePersistenceDelegate { 16 17 protected void initialize( 18 Class type, 19 Object oldInstance, 20 Object newInstance, 21 Encoder out) { 22 try { 23 BeanInfo info = Introspector.getBeanInfo(oldInstance.getClass()); 24 PropertyDescriptor[] d = info.getPropertyDescriptors(); 25 for (int i = 0; d != null && i < d.length; i++) { 26 doProperty( 27 oldInstance.getClass(), 28 d[i], 29 oldInstance, 30 newInstance, 31 out); 32 } 33 writeComponents(oldInstance, newInstance, out); 34 } catch (Exception e) { 35 e.printStackTrace(); 36 } 37 } 38 39 /* (non-Javadoc) 40 * @see java.beans.PersistenceDelegate#writeObject(java.lang.Object, java.beans.Encoder) 41 */ 42 public void writeComponents( 43 Object oldInstance, 44 Object newinstance, 45 Encoder arg1) { 46 47 if (oldInstance instanceof Iteration) { 48 for (Enumeration en = ((Iteration) oldInstance).stories(); 49 en != null && en.hasMoreElements(); 50 ) { 51 invokeStatement( 52 oldInstance, 53 "putStory", 54 new Object[] { en.nextElement()}, 55 arg1); 56 } 57 58 for (Enumeration en = ((Iteration) oldInstance).isolatedTasks(); 59 en != null && en.hasMoreElements(); 60 ) { 61 invokeStatement( 62 oldInstance, 63 "putIsolatedTask", 64 new Object[] { en.nextElement()}, 65 arg1); 66 } 67 68 } 69 } 70 }

This page was automatically generated by Maven