Package: TransformationConfiguration
TransformationConfiguration
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TransformationConfiguration(CliParams) |
|
|
|
|
|
||||||||||||||||||||
TransformationConfiguration(TransformationConfiguration.TransformationConfigurationBuilder) |
|
|
|
|
|
||||||||||||||||||||
areAllAxiomsIntegrityConstraints() |
|
|
|
|
|
||||||||||||||||||||
builder() |
|
|
|
|
|
||||||||||||||||||||
config(CliParams) |
|
|
|
|
|
||||||||||||||||||||
getCliParams() |
|
|
|
|
|
||||||||||||||||||||
getContext() |
|
|
|
|
|
||||||||||||||||||||
getPackageName() |
|
|
|
|
|
||||||||||||||||||||
getPropertiesType() |
|
|
|
|
|
||||||||||||||||||||
getTargetDir() |
|
|
|
|
|
||||||||||||||||||||
shouldGenerateAnnotationFields() |
|
|
|
|
|
||||||||||||||||||||
shouldGenerateJavadoc() |
|
|
|
|
|
||||||||||||||||||||
shouldGenerateOwlapiIris() |
|
|
|
|
|
||||||||||||||||||||
shouldGenerateThing() |
|
|
|
|
|
||||||||||||||||||||
shouldPreferMultilingualStrings() |
|
|
|
|
|
Coverage
1: /**
2: * Copyright (C) 2023 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.config;
16:
17: import cz.cvut.kbss.jopa.owl2java.cli.CliParams;
18: import cz.cvut.kbss.jopa.owl2java.cli.Option;
19: import cz.cvut.kbss.jopa.owl2java.cli.PropertiesType;
20:
21: public class TransformationConfiguration {
22:
23: private final String context;
24:
25: private final String packageName;
26:
27: private final String targetDir;
28:
29: private final boolean generateOwlapiIris;
30:
31: private final boolean generateJavadoc;
32:
33: private final boolean preferMultilingualStrings;
34:
35: private final PropertiesType propertiesType;
36:
37: private final boolean generateAnnotationFields;
38:
39: private final boolean generateThing;
40:
41: private final CliParams cliParams;
42:
43: private TransformationConfiguration(TransformationConfigurationBuilder builder) {
44: this.context = builder.context;
45: this.packageName = builder.packageName;
46: this.targetDir = builder.targetDir;
47: this.generateOwlapiIris = builder.owlapiIris;
48: this.generateJavadoc = builder.generateJavadoc;
49: this.preferMultilingualStrings = builder.preferMultilingualStrings;
50: this.propertiesType = builder.propertiesType;
51: this.generateAnnotationFields = builder.generateAnnotationFields;
52: this.generateThing = builder.generateThing;
53: this.cliParams = CliParams.empty();
54: }
55:
56: private TransformationConfiguration(CliParams cliParams) {
57: this.cliParams = cliParams;
58:• this.context = cliParams.is(Option.WHOLE_ONTOLOGY_AS_IC.arg) ? null : cliParams.valueOf(Option.CONTEXT.arg)
59: .toString();
60: this.packageName = cliParams.valueOf(Option.PACKAGE.arg).toString();
61: this.targetDir = cliParams.valueOf(Option.TARGET_DIR.arg).toString();
62: this.generateOwlapiIris = cliParams.is(Option.WITH_IRIS.arg, Defaults.WITH_IRIS);
63: this.generateJavadoc = cliParams.is(Option.GENERATE_JAVADOC_FROM_COMMENT.arg, Defaults.GENERATE_JAVADOC_FROM_COMMENT);
64: this.preferMultilingualStrings = cliParams.is(Option.PREFER_MULTILINGUAL_STRINGS.arg, Defaults.PREFER_MULTILINGUAL_STRINGS);
65: this.propertiesType = PropertiesType.fromParam(cliParams.valueOf(Option.PROPERTIES_TYPE.arg));
66: this.generateAnnotationFields = cliParams.is(Option.GENERATE_ANNOTATION_FIELDS.arg, Defaults.GENERATE_ANNOTATION_FIELDS);
67: this.generateThing = cliParams.is(Option.GENERATE_THING.arg, Defaults.GENERATE_THING);
68: }
69:
70: public String getContext() {
71: return context;
72: }
73:
74: public String getPackageName() {
75: return packageName;
76: }
77:
78: public String getTargetDir() {
79: return targetDir;
80: }
81:
82: public boolean areAllAxiomsIntegrityConstraints() {
83:• return context == null;
84: }
85:
86: public boolean shouldGenerateOwlapiIris() {
87: return generateOwlapiIris;
88: }
89:
90: public boolean shouldGenerateJavadoc() {
91: return generateJavadoc;
92: }
93:
94: public boolean shouldPreferMultilingualStrings() {
95: return preferMultilingualStrings;
96: }
97:
98: public PropertiesType getPropertiesType() {
99: return propertiesType;
100: }
101:
102: public boolean shouldGenerateAnnotationFields() {
103: return generateAnnotationFields;
104: }
105:
106: public boolean shouldGenerateThing() {
107: return generateThing;
108: }
109:
110: public CliParams getCliParams() {
111: return cliParams;
112: }
113:
114: public static TransformationConfiguration config(CliParams cliParams) {
115: return new TransformationConfiguration(cliParams);
116: }
117:
118: public static TransformationConfigurationBuilder builder() {
119: return new TransformationConfigurationBuilder();
120: }
121:
122: public static class TransformationConfigurationBuilder {
123: private String context;
124: private String packageName = Defaults.PACKAGE;
125: private String targetDir = Defaults.TARGET_DIR;
126: private PropertiesType propertiesType = PropertiesType.valueOf(Defaults.PROPERTIES_TYPE);
127: private boolean owlapiIris = Defaults.WITH_IRIS;
128: private boolean generateJavadoc = Defaults.GENERATE_JAVADOC_FROM_COMMENT;
129: private boolean preferMultilingualStrings = Defaults.PREFER_MULTILINGUAL_STRINGS;
130: private boolean generateAnnotationFields = Defaults.GENERATE_ANNOTATION_FIELDS;
131: private boolean generateThing = Defaults.GENERATE_THING;
132:
133: public TransformationConfigurationBuilder context(String context) {
134: this.context = context;
135: return this;
136: }
137:
138: public TransformationConfigurationBuilder packageName(String packageName) {
139: this.packageName = packageName;
140: return this;
141: }
142:
143: public TransformationConfigurationBuilder targetDir(String targetDir) {
144: this.targetDir = targetDir;
145: return this;
146: }
147:
148: public TransformationConfigurationBuilder addOwlapiIris(boolean add) {
149: this.owlapiIris = add;
150: return this;
151: }
152:
153: public TransformationConfigurationBuilder generateJavadoc(boolean javadoc) {
154: this.generateJavadoc = javadoc;
155: return this;
156: }
157:
158: public TransformationConfigurationBuilder preferMultilingualStrings(boolean preferMultilingualStrings) {
159: this.preferMultilingualStrings = preferMultilingualStrings;
160: return this;
161: }
162:
163: public TransformationConfigurationBuilder propertiesType(PropertiesType propertiesType) {
164: this.propertiesType = propertiesType;
165: return this;
166: }
167:
168: public TransformationConfigurationBuilder generateAnnotationFields(boolean generateAnnotationFields) {
169: this.generateAnnotationFields = generateAnnotationFields;
170: return this;
171: }
172:
173: public TransformationConfigurationBuilder generateThing(boolean generateThing) {
174: this.generateThing = generateThing;
175: return this;
176: }
177:
178: public TransformationConfiguration build() {
179: return new TransformationConfiguration(this);
180: }
181: }
182: }