org.xnap.commons.settings
Class StringValidator

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

public class StringValidator
extends Object
implements Validator

A string validator. Makes sure all characters of a string are valid and that it has a minimum length.


Field Summary
static StringValidator EMAIL
          Convenience validator for email addresses.
static StringValidator REGULAR_STRING
          Convenience validator for ordinary strings without whitespaces.
 
Constructor Summary
StringValidator()
          Constructs a string validator that accepts any non-null String.
StringValidator(String validChars)
          Constructs a string validator that accepts any non-null String composed of validChars.
StringValidator(String validChars, int minLength)
          Constructs a string validator that accepts any String composed of validChars with a minimum length of minlength characters.
 
Method Summary
 void validate(String value)
          Validates String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMAIL

public static final StringValidator EMAIL
Convenience validator for email addresses.


REGULAR_STRING

public static final StringValidator REGULAR_STRING
Convenience validator for ordinary strings without whitespaces.

Constructor Detail

StringValidator

public StringValidator(String validChars,
                       int minLength)
Constructs a string validator that accepts any String composed of validChars with a minimum length of minlength characters.

Parameters:
validChars - the allowed characters
minLength - the minimum length

StringValidator

public StringValidator(String validChars)
Constructs a string validator that accepts any non-null String composed of validChars.

Parameters:
validChars - the allowed characters

StringValidator

public StringValidator()
Constructs a string validator that accepts any non-null String.

Method Detail

validate

public void validate(String value)
Description copied from interface: Validator
Validates String.

Specified by:
validate in interface Validator


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