1 28 29 package com.idaremedia.antx.condition.solo; 30 31 import org.apache.tools.ant.BuildException; 32 import org.apache.tools.ant.Project; 33 import org.apache.tools.ant.taskdefs.condition.Condition; 34 35 import com.idaremedia.antx.AntX; 36 import com.idaremedia.antx.AssertableTask; 37 import com.idaremedia.antx.condition.Matches; 38 import com.idaremedia.antx.helpers.Strings; 39 import com.idaremedia.antx.parameters.FlexValueSupport; 40 import com.idaremedia.antx.parameters.IgnoreCaseEnabled; 41 import com.idaremedia.antx.parameters.TrimEnabled; 42 import com.idaremedia.antx.parameters.TrueFalsePropertySetter; 43 44 68 69 public final class MatchesTask extends AssertableTask 70 implements FlexValueSupport, IgnoreCaseEnabled, TrimEnabled, 71 TrueFalsePropertySetter, Condition 72 { 73 76 public MatchesTask() 77 { 78 super(AntX.conditions); 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 101 public void setPattern(String pattern) 102 { 103 m_impl.setPattern(pattern); 104 } 105 106 107 111 public String getPattern() 112 { 113 return m_impl.getPattern(); 114 } 115 116 117 121 public void setValue(String value) 122 { 123 m_impl.setValue(value); 124 } 125 126 127 131 public String getValue() 132 { 133 return m_impl.getLiteral(); 134 } 135 136 137 142 public void setProperty(String property) 143 { 144 m_impl.setProperty(property); 145 } 146 147 148 152 public String getProperty() 153 { 154 return m_impl.getProperty(); 155 } 156 157 158 163 public void setVariable(String variable) 164 { 165 m_impl.setVariable(variable); 166 } 167 168 169 172 public void setVar(String variable) 173 { 174 setVariable(variable); 175 } 176 177 178 182 public final String getVariable() 183 { 184 return m_impl.getVariable(); 185 } 186 187 188 193 public void setReference(String refid) 194 { 195 m_impl.setReference(refid); 196 } 197 198 199 203 public String getReference() 204 { 205 return m_impl.getReference(); 206 } 207 208 209 213 public void setTrim(boolean trim) 214 { 215 m_impl.setTrim(trim); 216 } 217 218 219 223 public final boolean willTrim() 224 { 225 return m_impl.willTrim(); 226 } 227 228 229 230 234 public void setIgnoreCase(boolean ignore) 235 { 236 m_impl.setIgnoreCase(ignore); 237 } 238 239 240 244 public final boolean isIgnoreCase() 245 { 246 return m_impl.isIgnoreCase(); 247 } 248 249 250 255 public void setFalseProperty(String property) 256 { 257 require_(property!=null,"setFalsP- nonzro nam"); 258 m_falseProperty = property; 259 } 260 261 262 266 public final String getFalseProperty() 267 { 268 return m_falseProperty; 269 } 270 271 272 277 public void setTrueProperty(String property) 278 { 279 require_(property!=null,"setTrueP- nonzro nam"); 280 m_trueProperty = property; 281 } 282 283 284 288 public final String getTrueProperty() 289 { 290 return m_trueProperty; 291 } 292 293 294 299 public boolean eval() throws BuildException 300 { 301 verifyCanExecute_("eval"); 302 303 boolean istrue= m_impl.eval(); 304 305 if (istrue && getTrueProperty()!=null) { 306 String prop = getTrueProperty(); 307 log("Match was true; setting true-property '"+prop+"' property", 308 Project.MSG_DEBUG); 309 getProject().setNewProperty(prop,Strings.TRUE); 310 } 311 if (!istrue && getFalseProperty()!=null) { 312 String prop = getFalseProperty(); 313 log("Match was false; setting false-property '"+prop+"' property", 314 Project.MSG_DEBUG); 315 getProject().setNewProperty(prop,Strings.TRUE); 316 } 317 318 return istrue; 319 } 320 321 322 327 public void execute() throws BuildException 328 { 329 eval(); 330 } 331 332 private final Matches m_impl= new Matches(); 333 private String m_falseProperty; 334 private String m_trueProperty; 335 } 336 337 338 | Popular Tags |