Skip to content

Package: TransformationConfiguration

TransformationConfiguration

nameinstructionbranchcomplexitylinemethod
TransformationConfiguration(CliParams)
M: 0 C: 62
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 13
100%
M: 0 C: 1
100%
TransformationConfiguration(TransformationConfiguration.TransformationConfigurationBuilder)
M: 0 C: 34
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 10
100%
M: 0 C: 1
100%
areAllAxiomsIntegrityConstraints()
M: 0 C: 7
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
builder()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
config(CliParams)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getCliParams()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getContext()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPackageName()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPropertiesType()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getTargetDir()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
shouldGenerateJavadoc()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
shouldGenerateOwlapiIris()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
shouldPreferMultilingualStrings()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (C) 2020 Czech Technical University in Prague
3: * <p>
4: * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
5: * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
6: * version.
7: * <p>
8: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
10: * details. You should have received a copy of the GNU General Public License along with this program. If not, see
11: * <http://www.gnu.org/licenses/>.
12: */
13: package cz.cvut.kbss.jopa.owl2java.config;
14:
15: import cz.cvut.kbss.jopa.owl2java.cli.CliParams;
16: import cz.cvut.kbss.jopa.owl2java.cli.Option;
17: import cz.cvut.kbss.jopa.owl2java.cli.PropertiesType;
18:
19: public class TransformationConfiguration {
20:
21: private final String context;
22:
23: private final String packageName;
24:
25: private final String targetDir;
26:
27: private final boolean generateOwlapiIris;
28:
29: private final boolean generateJavadoc;
30:
31: private final boolean preferMultilingualStrings;
32:
33: private final PropertiesType propertiesType;
34:
35: private final CliParams cliParams;
36:
37: private TransformationConfiguration(TransformationConfigurationBuilder builder) {
38: this.context = builder.context;
39: this.packageName = builder.packageName;
40: this.targetDir = builder.targetDir;
41: this.generateOwlapiIris = builder.owlapiIris;
42: this.generateJavadoc = builder.generateJavadoc;
43: this.preferMultilingualStrings = builder.preferMultilingualStrings;
44: this.propertiesType = builder.propertiesType;
45: this.cliParams = CliParams.empty();
46: }
47:
48: private TransformationConfiguration(CliParams cliParams) {
49: this.cliParams = cliParams;
50: this.context =
51:• cliParams.is(Option.WHOLE_ONTOLOGY_AS_IC.arg) ? null : cliParams.valueOf(Option.CONTEXT.arg).toString();
52: this.packageName = cliParams.valueOf(Option.PACKAGE.arg).toString();
53: this.targetDir = cliParams.valueOf(Option.TARGET_DIR.arg).toString();
54: this.generateOwlapiIris = cliParams.is(Option.WITH_IRIS.arg, Defaults.WITH_IRIS);
55: this.generateJavadoc = cliParams
56: .is(Option.GENERATE_JAVADOC_FROM_COMMENT.arg, Defaults.GENERATE_JAVADOC_FROM_COMMENT);
57: this.preferMultilingualStrings = cliParams
58: .is(Option.PREFER_MULTILINGUAL_STRINGS.arg, Defaults.PREFER_MULTILINGUAL_STRINGS);
59: this.propertiesType = PropertiesType.fromParam(cliParams.valueOf(Option.PROPERTIES_TYPE.arg));
60: }
61:
62: public String getContext() {
63: return context;
64: }
65:
66: public String getPackageName() {
67: return packageName;
68: }
69:
70: public String getTargetDir() {
71: return targetDir;
72: }
73:
74: public boolean areAllAxiomsIntegrityConstraints() {
75:• return context == null;
76: }
77:
78: public boolean shouldGenerateOwlapiIris() {
79: return generateOwlapiIris;
80: }
81:
82: public boolean shouldGenerateJavadoc() {
83: return generateJavadoc;
84: }
85:
86: public boolean shouldPreferMultilingualStrings() {
87: return preferMultilingualStrings;
88: }
89:
90: public PropertiesType getPropertiesType() {
91: return propertiesType;
92: }
93:
94: public CliParams getCliParams() {
95: return cliParams;
96: }
97:
98: public static TransformationConfiguration config(CliParams cliParams) {
99: return new TransformationConfiguration(cliParams);
100: }
101:
102: public static TransformationConfigurationBuilder builder() {
103: return new TransformationConfigurationBuilder();
104: }
105:
106: public static class TransformationConfigurationBuilder {
107: private String context;
108: private String packageName = Defaults.PACKAGE;
109: private String targetDir = Defaults.TARGET_DIR;
110: private PropertiesType propertiesType = PropertiesType.valueOf(Defaults.PROPERTIES_TYPE);
111: private boolean owlapiIris = Defaults.WITH_IRIS;
112: private boolean generateJavadoc = Defaults.GENERATE_JAVADOC_FROM_COMMENT;
113: private boolean preferMultilingualStrings = true;
114:
115: public TransformationConfigurationBuilder context(String context) {
116: this.context = context;
117: return this;
118: }
119:
120: public TransformationConfigurationBuilder packageName(String packageName) {
121: this.packageName = packageName;
122: return this;
123: }
124:
125: public TransformationConfigurationBuilder targetDir(String targetDir) {
126: this.targetDir = targetDir;
127: return this;
128: }
129:
130: public TransformationConfigurationBuilder addOwlapiIris(boolean add) {
131: this.owlapiIris = add;
132: return this;
133: }
134:
135: public TransformationConfigurationBuilder generateJavadoc(boolean javadoc) {
136: this.generateJavadoc = javadoc;
137: return this;
138: }
139:
140: public TransformationConfigurationBuilder preferMultilingualStrings(boolean preferMultilingualStrings) {
141: this.preferMultilingualStrings = preferMultilingualStrings;
142: return this;
143: }
144:
145: public TransformationConfigurationBuilder propertiesType(PropertiesType propertiesType) {
146: this.propertiesType = propertiesType;
147: return this;
148: }
149:
150: public TransformationConfiguration build() {
151: return new TransformationConfiguration(this);
152: }
153: }
154: }