hudson.plugins.tasks.util.SingleFieldValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tasks Show documentation
Show all versions of tasks Show documentation
This plug-in scans the workspace files for open tasks
and generates a trend report.
package hudson.plugins.tasks.util;
import hudson.util.FormFieldValidator;
import java.io.IOException;
import javax.servlet.ServletException;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
/**
* Form field validator base class with template method to validate a single field value.
* You need the following steps to validate a single form field:
*
* - Create a subclass of {@link SingleFieldValidator}.
* - Create a subclass of {@link AbstractValidatorTest} with corresponding
* unit tests.
* - Add a new entry in your jelly file with the attribute {@code field} named
* like your publishers or reporters property, e.g.
*
*
* <f:editableComboBox id="defaultEncoding" field="defaultEncoding" items="${allEncodings}"/>
* <f:textbox field="threshold"/>
*
* - Create a method in your plug-in descriptor like {@link PluginDescriptor#doCheckDefaultEncoding(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse)} for the property {@code defaultEncoding}.
*
*
* @author Ulli Hafner
*/
public abstract class SingleFieldValidator extends FormFieldValidator {
/**
* Creates a new instance of FormValidator
.
* @param request
* Stapler request
* @param response
* Stapler response
*/
public SingleFieldValidator(final StaplerRequest request, final StaplerResponse response) {
super(request, response, false);
}
/** {@inheritDoc} */
@Override
public final void check() throws IOException, ServletException {
check(request.getParameter("value"));
}
/**
* Checks the input value.
*
* @param value
* the value to check
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws ServletException
* the servlet exception
*/
public abstract void check(final String value) throws IOException, ServletException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy