Skip to content

Package: TransformationConfiguration$TransformationConfigurationBuilder

TransformationConfiguration$TransformationConfigurationBuilder

nameinstructionbranchcomplexitylinemethod
TransformationConfiguration.TransformationConfigurationBuilder()
M: 0 C: 19
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
addOwlapiIris(boolean)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
build()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
context(String)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
generateJavadoc(boolean)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
packageName(String)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
propertiesType(PropertiesType)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
targetDir(String)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (C) 2020 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 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.propertiesType = builder.propertiesType;
44: this.cliParams = CliParams.empty();
45: }
46:
47: private TransformationConfiguration(CliParams cliParams) {
48: this.cliParams = cliParams;
49: this.context =
50: cliParams.is(Option.WHOLE_ONTOLOGY_AS_IC.arg) ? null : cliParams.valueOf(Option.CONTEXT.arg).toString();
51: this.packageName = cliParams.valueOf(Option.PACKAGE.arg).toString();
52: this.targetDir = cliParams.valueOf(Option.TARGET_DIR.arg).toString();
53: this.generateOwlapiIris = cliParams.is(Option.WITH_IRIS.arg, Defaults.WITH_IRIS);
54: this.generateJavadoc = cliParams
55: .is(Option.GENERATE_JAVADOC_FROM_COMMENT.arg, Defaults.GENERATE_JAVADOC_FROM_COMMENT);
56: this.propertiesType = PropertiesType.fromParam(cliParams.valueOf(Option.PROPERTIES_TYPE.arg));
57: }
58:
59: public String getContext() {
60: return context;
61: }
62:
63: public String getPackageName() {
64: return packageName;
65: }
66:
67: public String getTargetDir() {
68: return targetDir;
69: }
70:
71: public boolean areAllAxiomsIntegrityConstraints() {
72: return context == null;
73: }
74:
75: public boolean shouldGenerateOwlapiIris() {
76: return generateOwlapiIris;
77: }
78:
79: public boolean shouldGenerateJavadoc() {
80: return generateJavadoc;
81: }
82:
83: public PropertiesType getPropertiesType() {
84: return propertiesType;
85: }
86:
87: public CliParams getCliParams() {
88: return cliParams;
89: }
90:
91: public static TransformationConfiguration config(CliParams cliParams) {
92: return new TransformationConfiguration(cliParams);
93: }
94:
95: public static TransformationConfigurationBuilder builder() {
96: return new TransformationConfigurationBuilder();
97: }
98:
99: public static class TransformationConfigurationBuilder {
100: private String context;
101: private String packageName = Defaults.PACKAGE;
102: private String targetDir = Defaults.TARGET_DIR;
103: private PropertiesType propertiesType = PropertiesType.valueOf(Defaults.PROPERTIES_TYPE);
104: private boolean owlapiIris = Defaults.WITH_IRIS;
105: private boolean generateJavadoc = Defaults.GENERATE_JAVADOC_FROM_COMMENT;
106:
107: public TransformationConfigurationBuilder context(String context) {
108: this.context = context;
109: return this;
110: }
111:
112: public TransformationConfigurationBuilder packageName(String packageName) {
113: this.packageName = packageName;
114: return this;
115: }
116:
117: public TransformationConfigurationBuilder targetDir(String targetDir) {
118: this.targetDir = targetDir;
119: return this;
120: }
121:
122: public TransformationConfigurationBuilder addOwlapiIris(boolean add) {
123: this.owlapiIris = add;
124: return this;
125: }
126:
127: public TransformationConfigurationBuilder generateJavadoc(boolean javadoc) {
128: this.generateJavadoc = javadoc;
129: return this;
130: }
131:
132: public TransformationConfigurationBuilder propertiesType(PropertiesType propertiesType) {
133: this.propertiesType = propertiesType;
134: return this;
135: }
136:
137: public TransformationConfiguration build() {
138: return new TransformationConfiguration(this);
139: }
140: }
141: }