All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hudson.plugins.tasks.util.SingleFieldValidator Maven / Gradle / Ivy

Go to download

This plug-in scans the workspace files for open tasks and generates a trend report.

There is a newer version: 4.13
Show newest version
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:
 * 
    *
  1. Create a subclass of {@link SingleFieldValidator}.
  2. *
  3. Create a subclass of {@link AbstractValidatorTest} with corresponding * unit tests.
  4. *
  5. 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"/>
     * 
    *
  6. 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}.
  7. *
* * @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