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

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

public class UrlValidator
extends java.lang.Object
implements IValidator

A validator for URLs. For convenience a static version is also supplied com.ibm.commons.iloader.node.validators.UriValidator.instance.

See Also:
URL

Field Summary
static UrlValidator instance
          A static instance of this validator.
 
Constructor Summary
UrlValidator()
          Creates a new URL validator.
UrlValidator(boolean isEmptyValid)
          Creates a new URL validator.
 
Method Summary
 boolean isBeingValid(java.lang.String value)
          Always returns true.
 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 UrlValidator instance
A static instance of this validator. Empty values are NOT considered valid.

Constructor Detail

UrlValidator

public UrlValidator()
Creates a new URL validator.


UrlValidator

public UrlValidator(boolean isEmptyValid)
Creates a new URL validator. This constructor allows the caller to configure whether or not empty urls are allowed.

Parameters:
isEmptyValid - true if the url is considered valid when empty. False if a value if required.
Method Detail

isBeingValid

public boolean isBeingValid(java.lang.String value)
Always returns true.

Specified by:
isBeingValid in interface IValidator
Parameters:
-
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.