1 28 29 package com.idaremedia.antx.condition; 30 31 import org.apache.tools.ant.BuildException; 32 import org.apache.tools.ant.Project; 33 34 import com.idaremedia.antx.FlexString; 35 import com.idaremedia.antx.StringEquality; 36 import com.idaremedia.antx.parameters.IgnoreCaseEnabled; 37 import com.idaremedia.antx.parameters.TrimEnabled; 38 import com.idaremedia.antx.parameters.ValueMatchEnabled; 39 40 65 66 public final class StringEquals extends FlexCondition 67 implements IgnoreCaseEnabled, TrimEnabled, ValueMatchEnabled 68 { 69 74 public StringEquals() 75 { 76 super(); 77 m_impl.setOperator(StringEquality.OP_EQUALS); 78 getValueHelper().setLenient(false); 79 } 80 81 82 86 public void setProject(Project P) 87 { 88 super.setProject(P); 89 m_impl.setProject(P); 90 } 91 92 93 97 protected final FlexString getValueHelper() 98 { 99 return m_impl.getUnknownValueGetter(); 100 } 101 102 103 107 111 public void setMatch(String value) 112 { 113 require_(value!=null,"setMatch- nonzro mtch valu"); 114 m_impl.setKnownArg(value); 115 } 116 117 118 122 public final String getMatch() 123 { 124 return m_impl.getKnownArg(); 125 } 126 127 128 129 133 public final void setValue(String value) 134 { 135 require_(value!=null,"setValue- nonzro"); 136 setLiteral(value); 137 } 138 139 140 141 145 public void setTrim(boolean trim) 146 { 147 m_impl.setTrim(trim); 148 } 149 150 151 155 public final boolean willTrim() 156 { 157 return m_impl.willTrim(); 158 } 159 160 161 162 166 public void setIgnoreCase(boolean ignore) 167 { 168 m_impl.setIgnoreCase(ignore); 169 } 170 171 172 176 public final boolean isIgnoreCase() 177 { 178 return m_impl.isIgnoreCase(); 179 } 180 181 182 186 190 public boolean eval() 191 { 192 verifyCanEvaluate_("eval"); 193 194 return m_impl.eval(); 195 } 196 197 198 204 protected void verifyCanEvaluate_(String calr) 205 { 206 super.verifyCanEvaluate_(calr); 207 208 if (getMatch()==null) { 209 String ermsg = uistrs().get("task.needs.this.attr", 210 getTypicalName(),"match"); 211 log(ermsg,Project.MSG_ERR); 212 throw new BuildException(ermsg); 213 } 214 } 215 216 217 private final StringEquality m_impl = new StringEquality(); 218 } 219 220 221 | Popular Tags |