/** * Checks to make sure all settings are kosher. In this case, it * means that the pattern attribute has been set. * */ public void verifySettings() { if (contains == null) { setError("The text attribute is required"); } }
/** * When using this as a custom selector, this method will be called. * It translates each parameter into the appropriate setXXX() call. * * @param parameters the complete set of parameters for this selector */ public void setParameters(Parameter... parameters) { super.setParameters(parameters); if (parameters != null) { for (Parameter parameter : parameters) { String paramname = parameter.getName(); if (CONTAINS_KEY.equalsIgnoreCase(paramname)) { setText(parameter.getValue()); } else if (CASE_KEY.equalsIgnoreCase(paramname)) { setCasesensitive(Project.toBoolean( parameter.getValue())); } else if (WHITESPACE_KEY.equalsIgnoreCase(paramname)) { setIgnorewhitespace(Project.toBoolean( parameter.getValue())); } else { setError("Invalid parameter " + paramname); } } } }
/** * The heart of the matter. This is where the selector gets to decide * on the inclusion of a file in a particular fileset. * * @param basedir the base directory the scan is being done from * @param filename is the name of the file to check * @param file is a java.io.File object the selector can use * @return whether the file should be selected or not */ public boolean isSelected(File basedir, String filename, File file) { return isSelected(new FileResource(file)); }