com.ibm.commons.iloader.node.validators
Class IntegerValidator

java.lang.Object
  extended by com.ibm.commons.iloader.node.validators.IntegerValidator
All Implemented Interfaces:
IValidator

public class IntegerValidator
extends java.lang.Object
implements IValidator

A validator that ensures the value entered is an integer. It is advised to use the static instance of this class, com.ibm.commons.iloader.node.validators.IntegerValidator.instance.


Field Summary
static IntegerValidator instance
          A static validator that validates a value is an integer.
static IntegerValidator maxPositiveLongInstance
          A static validator that validates that a value is less that the maximum allowable integer value.
static IntegerValidator positiveInstance
          A static validator that validates that a value is a positive integer.
 
Constructor Summary
IntegerValidator()
          Creates a new integer validator.
IntegerValidator(java.lang.Long minValue, java.lang.Long maxValue)
          Creates a new integer validator which only allows values between the desired range.
 
Method Summary
 boolean isBeingValid(java.lang.String value)
          Determines if the current value is valid.
 boolean isValid(java.lang.String value, Messages messages)
          Determines if the overall input is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static final IntegerValidator instance
A static validator that validates a value is an integer.


positiveInstance

public static final IntegerValidator positiveInstance
A static validator that validates that a value is a positive integer.


maxPositiveLongInstance

public static final IntegerValidator maxPositiveLongInstance
A static validator that validates that a value is less that the maximum allowable integer value.

Constructor Detail

IntegerValidator

public IntegerValidator()
Creates a new integer validator.


IntegerValidator

public IntegerValidator(java.lang.Long minValue,
                        java.lang.Long maxValue)
Creates a new integer validator which only allows values between the desired range.

Parameters:
minValue - the mimimum allowed value
maxValue - the maximum allowed value
Method Detail

isBeingValid

public boolean isBeingValid(java.lang.String value)
Description copied from interface: IValidator
Determines if the current value is valid. If it is not valid then it will not be accepted by the widget as being a valid input. (e.g. inputEvent.doit = false)

Specified by:
isBeingValid in interface IValidator
Parameters:
value - the string value which has been entered by the end user and requires validation.
Returns:
true if the input should be accepted.

isValid

public boolean isValid(java.lang.String value,
                       Messages messages)
Description copied from interface: IValidator
Determines if the overall input is valid. If the input is valid then true is returned and no further action is required. If the input is invalid false is returned an a message can optionally be added to the messages bundle. Any messages added will be displayed to the end user in the form of a messagebox.

Specified by:
isValid in interface IValidator
Parameters:
value - the string value which has been entered by the end user and requires validation.
messages - a bundle of messages to be displayed to the end user in the event that validation fails.
Returns:
true if the input should be accepted.