hudson.plugins.tasks.util
Class ThresholdValidator
java.lang.Object
hudson.util.FormFieldValidator
hudson.plugins.tasks.util.SingleFieldValidator
hudson.plugins.tasks.util.ThresholdValidator
public class ThresholdValidator
- extends SingleFieldValidator
Validates and converts threshold parameters. A threshold must be an integer
value greater or equal 0 or the empty string.
- Author:
- Ulli Hafner
| Nested classes/interfaces inherited from class hudson.util.FormFieldValidator |
hudson.util.FormFieldValidator.Base64, hudson.util.FormFieldValidator.Executable, hudson.util.FormFieldValidator.HudsonURL, hudson.util.FormFieldValidator.NonNegativeInteger, hudson.util.FormFieldValidator.URLCheck, hudson.util.FormFieldValidator.WorkspaceDirectory, hudson.util.FormFieldValidator.WorkspaceFileMask, hudson.util.FormFieldValidator.WorkspaceFilePath |
| Fields inherited from class hudson.util.FormFieldValidator |
CHECK, permission, request, response, subject |
|
Method Summary |
void |
check(java.lang.String value)
Checks the input value. |
static int |
convert(java.lang.String threshold)
Converts the provided string threshold into an integer value. |
static boolean |
isValid(java.lang.String threshold)
Returns whether the provided threshold string parameter is a valid
threshold number, i.e. |
| Methods inherited from class hudson.util.FormFieldValidator |
error, error, errorWithMarkup, getFileParameter, ok, ok, ok, okWithMarkup, process, respond, warning, warning, warningWithMarkup |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThresholdValidator
public ThresholdValidator(org.kohsuke.stapler.StaplerRequest request,
org.kohsuke.stapler.StaplerResponse response)
- Creates a new instance of
ThresholdValidator.
- Parameters:
request - Stapler requestresponse - Stapler response
check
public void check(java.lang.String value)
throws java.io.IOException,
javax.servlet.ServletException
- Checks the input value.
- Specified by:
check in class SingleFieldValidator
- Parameters:
value - the value to check
- Throws:
java.io.IOException - Signals that an I/O exception has occurred.
javax.servlet.ServletException - the servlet exception
isValid
public static boolean isValid(java.lang.String threshold)
- Returns whether the provided threshold string parameter is a valid
threshold number, i.e. an integer value greater or equal zero.
- Parameters:
threshold - string representation of the threshold value
- Returns:
true if the provided threshold string parameter is a
valid number >= 0
convert
public static int convert(java.lang.String threshold)
- Converts the provided string threshold into an integer value.
- Parameters:
threshold - string representation of the threshold value
- Returns:
- integer threshold
- Throws:
java.lang.IllegalArgumentException - if the provided string can't be converted to an integer value
greater or equal zero
Copyright © 2009. All Rights Reserved.