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