Skip to contentMethod: getCommandList()
1: /**
2: * Copyright (C) 2022 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.owl2java.cli;
16:
17: import cz.cvut.kbss.jopa.owl2java.config.Defaults;
18: import joptsimple.OptionParser;
19:
20: import static cz.cvut.kbss.jopa.owl2java.cli.Option.*;
21:
22: public final class CommandParserProvider {
23:
24: private CommandParserProvider() {
25: throw new AssertionError();
26: }
27:
28: public static OptionParser getCommandHelp() {
29: return new OptionParser();
30: }
31:
32: public static OptionParser getCommandList() {
33: final ParamOptionParser p = new ParamOptionParser();
34: p.accepts(MAPPING_FILE).withRequiredArg().ofType(String.class);
35: return p;
36: }
37:
38: public static OptionParser getCommandTransform() {
39: ParamOptionParser p = initParserWithCommonOptions();
40: p.accepts(JAVA_CLASSNAME_ANNOTATION).withRequiredArg().ofType(String.class)
41: .defaultsTo(Defaults.JAVA_CLASSNAME_ANNOTATION);
42: p.accepts(PROPERTIES_TYPE).withRequiredArg().ofType(String.class).defaultsTo(Defaults.PROPERTIES_TYPE);
43: return p;
44: }
45:
46: private static ParamOptionParser initParserWithCommonOptions() {
47: final ParamOptionParser p = new ParamOptionParser();
48: p.accepts(MAPPING_FILE).withRequiredArg().ofType(String.class);
49: p.accepts(PACKAGE).withRequiredArg().ofType(String.class).defaultsTo(Defaults.PACKAGE);
50: p.accepts(CONTEXT).withRequiredArg().ofType(String.class);
51: p.accepts(WITH_IRIS).withOptionalArg().ofType(Boolean.class).defaultsTo(true);
52: p.accepts(TARGET_DIR).withRequiredArg().ofType(String.class).defaultsTo(Defaults.TARGET_DIR);
53: p.accepts(WHOLE_ONTOLOGY_AS_IC).withOptionalArg().ofType(Boolean.class).defaultsTo(true);
54: p.accepts(IGNORE_FAILED_IMPORTS).withOptionalArg().ofType(Boolean.class).defaultsTo(true);
55: p.accepts(GENERATE_JAVADOC_FROM_COMMENT).withOptionalArg().ofType(Boolean.class).defaultsTo(true);
56: return p;
57: }
58:
59: public static OptionParser getCommandVersion() {
60: return new OptionParser();
61: }
62:
63: public static OptionParser getCommandVocabulary() {
64: return initParserWithCommonOptions();
65: }
66: }