net.dpml.cli.validation
Class URIValidator

java.lang.Object
  extended by net.dpml.cli.validation.URIValidator
All Implemented Interfaces:
Validator

public class URIValidator
extends Object
implements Validator

The URIValidator validates the string argument values are valid URIs. If the value is a URI, the string value in the List of values is replaced with the URI instance. The following example shows how to limit the valid values for the site argument to 'artifact' URIs.

 ...
 ArgumentBuilder builder = new ArgumentBuilder();
 Argument plugin =
   builder
     .withName("plugin");
     .withValidator( new URIValidator( "artifact", "link" ) );
 

Version:
1.0.0
Author:
Digital Product Meta Library

Constructor Summary
URIValidator()
          Creates a UriValidator.
URIValidator(String scheme)
          Creates a UriValidator for the specified scheme.
URIValidator(String[] schemes)
          Creates a UriValidator for the specified schemes.
 
Method Summary
 void validate(List values)
          Validate the list of values against the list of permitted values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URIValidator

public URIValidator()
Creates a UriValidator.


URIValidator

public URIValidator(String scheme)
Creates a UriValidator for the specified scheme.

Parameters:
scheme - the uri scheme

URIValidator

public URIValidator(String[] schemes)
Creates a UriValidator for the specified schemes.

Parameters:
schemes - an array of schemes
Method Detail

validate

public void validate(List values)
              throws InvalidArgumentException
Validate the list of values against the list of permitted values. If a value is valid, replace the string in the values List with the URI instance.

Specified by:
validate in interface Validator
Parameters:
values - the list of values to validate
Throws:
InvalidArgumentException - if a value is invalid
See Also:
Validator.validate(java.util.List)