1 18 19 package org.apache.tools.ant.types.selectors; 20 21 import java.io.File ; 22 23 import org.apache.tools.ant.BuildException; 24 import org.apache.tools.ant.types.DataType; 25 26 34 public abstract class BaseSelector extends DataType implements FileSelector { 35 36 private String errmsg = null; 37 38 39 42 public BaseSelector() { 43 } 44 45 51 public void setError(String msg) { 52 if (errmsg == null) { 53 errmsg = msg; 54 } 55 } 56 57 62 public String getError() { 63 return errmsg; 64 } 65 66 67 74 public void verifySettings() { 75 if (isReference()) { 76 ((BaseSelector) getCheckedRef()).verifySettings(); 77 } 78 } 79 80 81 85 public void validate() { 86 if (getError() == null) { 87 verifySettings(); 88 } 89 if (getError() != null) { 90 throw new BuildException(errmsg); 91 } 92 } 93 94 105 public abstract boolean isSelected(File basedir, String filename, 106 File file); 107 108 } 109 110 111 | Popular Tags |