blob: 2b8f07bf3151a44234d3e4d24897c33e442c2209 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package com.beust.jcommander;
import com.beust.jcommander.converters.FileConverter;
import java.io.File;
public class ArgsValidate2 {
public static class FailingValidator implements IValueValidator<File> {
public void validate(String name, File value) throws ParameterException {
throw new ParameterException("Validation will always fail:" + name + " " + value);
}
}
public static final String POSSIBLE_TEMPLATE_FILE = "mayOrMayNotExist.template";
@Parameter(names = { "-template"},
description = "The default file may or may not exist",
converter = FileConverter.class,
validateValueWith = FailingValidator.class
)
public File template = new File(POSSIBLE_TEMPLATE_FILE);
}
|