org.xnap.commons.settings
Class PortRangeValidator

java.lang.Object
  extended by org.xnap.commons.settings.PortRangeValidator
All Implemented Interfaces:
Validator

public class PortRangeValidator
extends Object
implements Validator

A port range validator. Port ranges are used to specify one or more tcp ports. The format is: [([:number:]*|[:number:]*-[:number:]*);]* TODO there must be a + somewhere, the empty string is not allowed


Field Summary
static PortRangeValidator DEFAULT
          The default validator that allows ranges between PortRange.MIN_PORT and PortRange.MAX_PORT.
 
Constructor Summary
PortRangeValidator()
           
PortRangeValidator(int min, int max)
           
 
Method Summary
 void check(int i)
          Checks if i is in range.
 void validate(String value)
          Checks if value is a valid port range string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final PortRangeValidator DEFAULT
The default validator that allows ranges between PortRange.MIN_PORT and PortRange.MAX_PORT.

Constructor Detail

PortRangeValidator

public PortRangeValidator(int min,
                          int max)

PortRangeValidator

public PortRangeValidator()
Method Detail

validate

public void validate(String value)
Checks if value is a valid port range string.

Specified by:
validate in interface Validator
Throws:
IllegalArgumentException - if string format is invalid

check

public void check(int i)
Checks if i is in range.

Throws:
IllegalArgumentException - thrown if i is not in range


Copyright © 2004-2007 XNap Commons Team. All Rights Reserved.