1 18 19 20 package sync4j.framework.core; 21 22 import java.util.List ; 23 import java.util.Arrays ; 24 import java.util.ArrayList ; 25 26 33 public abstract class ItemizedCommand 34 extends AbstractCommand 35 implements java.io.Serializable { 36 38 protected ArrayList items = new ArrayList (); 42 protected Meta meta ; 43 44 46 47 protected ItemizedCommand() {} 48 49 58 public ItemizedCommand(CmdID cmdID, Meta meta, Item[] items) { 59 super(cmdID); 60 61 if (cmdID == null) { 62 throw new IllegalArgumentException ("cmdID cannot be null or empty"); 63 } 64 65 if (items == null) { 66 items = new Item[0]; 67 } 68 69 this.meta = meta; 70 setItems(items); 71 } 72 73 81 public ItemizedCommand(final CmdID cmdID, final Item[] items) { 82 this(cmdID, null, items); 83 } 84 85 87 92 public java.util.ArrayList getItems() { 93 return this.items; 94 } 95 96 101 public void setItems(Item[] items) { 102 if (items != null) { 103 this.items.clear(); 104 this.items.addAll(Arrays.asList(items)); 105 } else { 106 this.items = null; 107 } 108 } 109 110 115 public Meta getMeta() { 116 return meta; 117 } 118 119 125 public void setMeta(Meta meta) { 126 this.meta = meta; 127 } 128 129 134 public abstract String getName(); 135 } | Popular Tags |