net.dpml.cli.validation
Class URIValidator
java.lang.Object
net.dpml.cli.validation.URIValidator
- Validator
The
URIValidator
validates the string argument
values are valid URIs. If the value is a URI, the string value in
the
java.util.List
of values is replaced with the
java.net.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" ) );
URIValidator() - Creates a UriValidator.
|
URIValidator(String scheme) - Creates a UriValidator for the specified scheme.
|
URIValidator(String[] schemes) - Creates a UriValidator for the specified schemes.
|
void | validate(List values) - Validate the list of values against the list of permitted values.
|
URIValidator
public URIValidator(String scheme)
Creates a UriValidator for the specified scheme.
URIValidator
public URIValidator(String[] schemes)
Creates a UriValidator for the specified schemes.
schemes
- an array of schemes
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
java.util.List
with the java.net.URI
instance.
- validate in interface Validator
values
- the list of values to validate
net.dpml.cli.validation.Validator.validate(java.util.List)