1 18 19 20 package sync4j.framework.core; 21 22 29 public abstract class AbstractCommand 30 implements java.io.Serializable { 31 32 protected CmdID cmdID ; 34 protected Boolean noResp ; 35 protected Meta meta ; 36 protected Cred credential; 37 38 40 41 protected AbstractCommand() {} 42 43 51 public AbstractCommand(final CmdID cmdID, final boolean noResp) { 52 setCmdID(cmdID); 53 this.noResp = (noResp) ? new Boolean (noResp) : null; 54 } 55 56 62 public AbstractCommand(final CmdID cmdID) { 63 this(cmdID, false); 64 } 65 66 74 public AbstractCommand(final CmdID cmdID, 75 final boolean noResp, 76 final Meta meta) { 77 setCmdID(cmdID); 78 this.noResp = (noResp) ? new Boolean (noResp) : null; 79 setMeta(meta); 80 } 81 82 88 public CmdID getCmdID() { 89 return this.cmdID; 90 } 91 92 98 public void setCmdID(CmdID cmdID) { 99 if (cmdID == null) { 100 throw new IllegalArgumentException ("cmdID cannot be null"); 101 } 102 this.cmdID = cmdID; 103 } 104 105 110 public boolean isNoResp() { 111 return (noResp != null); 112 } 113 114 public Boolean getNoResp() { 115 if ((noResp != null) && !noResp.booleanValue()) { 116 return null; 117 } 118 return noResp; 119 } 120 121 127 public void setNoResp(Boolean noResp) { 128 this.noResp = (noResp.booleanValue()) ? noResp : null; 129 } 130 131 136 public Cred getCred() { 137 return credential; 138 } 139 140 146 public void setCred(Cred cred) { 147 this.credential = cred; 148 } 149 150 155 public Meta getMeta() { 156 return meta; 157 } 158 159 165 public void setMeta(Meta meta) { 166 this.meta = meta; 167 } 168 169 174 public abstract String getName(); 175 } 176 | Popular Tags |