01: package org.kohsuke.args4j.spi;
02:
03: import java.io.File;
04:
05: import org.kohsuke.args4j.OptionDef;
06: import org.kohsuke.args4j.CmdLineException;
07: import org.kohsuke.args4j.CmdLineParser;
08:
09: /**
10: * {@link File} {@link OptionHandler}.
11: *
12: * @author Kohsuke Kawaguchi
13: */
14: public class FileOptionHandler extends OptionHandler<File> {
15: public FileOptionHandler(CmdLineParser parser, OptionDef option,
16: Setter<? super File> setter) {
17: super (parser, option, setter);
18: }
19:
20: @Override
21: public int parseArguments(Parameters params)
22: throws CmdLineException {
23: setter.addValue(new File(params.getParameter(0)));
24: return 1;
25: }
26:
27: @Override
28: public String getDefaultMetaVariable() {
29: return "FILE";
30: }
31: }
|