hudson.plugins.analysis.util
Class ThresholdValidator

java.lang.Object
  extended by hudson.plugins.analysis.util.ThresholdValidator
All Implemented Interfaces:
Validator

public class ThresholdValidator
extends Object
implements Validator

Validates and converts threshold parameters. A threshold must be an integer value greater or equal 0 or the empty string.

Author:
Ulli Hafner

Constructor Summary
ThresholdValidator()
           
 
Method Summary
 hudson.util.FormValidation check(String value)
          Validates the specified value.
static int convert(String threshold)
          Converts the provided string threshold into an integer value.
static boolean isValid(String threshold)
          Returns whether the provided threshold string parameter is a valid threshold number, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThresholdValidator

public ThresholdValidator()
Method Detail

check

public hudson.util.FormValidation check(String value)
                                 throws hudson.util.FormValidation
Validates the specified value. If the value is not valid then a FormValidation exception must be thrown.

Specified by:
check in interface Validator
Parameters:
value - the value to validate
Returns:
a positive FormValidation object
Throws:
hudson.util.FormValidation - if the encoding is not valid

isValid

public static boolean isValid(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(String threshold)
Converts the provided string threshold into an integer value.

Parameters:
threshold - string representation of the threshold value
Returns:
integer threshold
Throws:
IllegalArgumentException - if the provided string can't be converted to an integer value greater or equal zero


Copyright © 2004-2012 Hudson. All Rights Reserved.