1 18 19 20 package sync4j.framework.core; 21 22 23 31 public final class TargetRef 32 implements java.io.Serializable { 33 34 36 private String value; 37 private String query; 38 private Target target; 39 40 42 45 protected TargetRef() {} 46 47 55 public TargetRef(final String value) { 56 setValue(value); 57 } 58 59 67 public TargetRef(final Target target) { 68 setTarget(target); 69 setValue(target.getLocURI()); 70 } 71 72 74 79 public String getValue() { 80 return value; 81 } 82 83 88 public void setValue(String value) { 89 if (value == null) { 90 this.value = ""; 91 this.query = ""; 92 } else { 93 int qMark = value.indexOf('?'); 94 if (qMark == -1) { 95 this.value = value; 96 this.query = ""; 97 } else { 98 this.value = value.substring(0, qMark); 99 this.query = value.substring(qMark); 100 } 101 } 102 } 103 104 109 public Target getTarget() { 110 return this.target; 111 } 112 113 118 public void setTarget(Target target) { 119 if (target == null) { 120 throw new IllegalArgumentException ("target cannot be null"); 121 } 122 this.target = target; 123 } 124 } 125 | Popular Tags |