Skip to content

Method: generateJavadoc(boolean)

1: package cz.cvut.kbss.jopa.owl2java.config;
2:
3: import cz.cvut.kbss.jopa.owl2java.cli.CliParams;
4: import cz.cvut.kbss.jopa.owl2java.cli.Option;
5: import cz.cvut.kbss.jopa.owl2java.cli.PropertiesType;
6:
7: public class TransformationConfiguration {
8:
9: private final String context;
10:
11: private final String packageName;
12:
13: private final String targetDir;
14:
15: private final boolean generateOwlapiIris;
16:
17: private final boolean generateJavadoc;
18:
19: private final PropertiesType propertiesType;
20:
21: private final CliParams cliParams;
22:
23: private TransformationConfiguration(TransformationConfigurationBuilder builder) {
24: this.context = builder.context;
25: this.packageName = builder.packageName;
26: this.targetDir = builder.targetDir;
27: this.generateOwlapiIris = builder.owlapiIris;
28: this.generateJavadoc = builder.generateJavadoc;
29: this.propertiesType = builder.propertiesType;
30: this.cliParams = CliParams.empty();
31: }
32:
33: private TransformationConfiguration(CliParams cliParams) {
34: this.cliParams = cliParams;
35: this.context =
36: cliParams.is(Option.WHOLE_ONTOLOGY_AS_IC.arg) ? null : cliParams.valueOf(Option.CONTEXT.arg).toString();
37: this.packageName = cliParams.valueOf(Option.PACKAGE.arg).toString();
38: this.targetDir = cliParams.valueOf(Option.TARGET_DIR.arg).toString();
39: this.generateOwlapiIris = cliParams.is(Option.WITH_IRIS.arg, Defaults.WITH_IRIS);
40: this.generateJavadoc = cliParams
41: .is(Option.GENERATE_JAVADOC_FROM_COMMENT.arg, Defaults.GENERATE_JAVADOC_FROM_COMMENT);
42: this.propertiesType = PropertiesType.fromParam(cliParams.valueOf(Option.PROPERTIES_TYPE.arg));
43: }
44:
45: public String getContext() {
46: return context;
47: }
48:
49: public String getPackageName() {
50: return packageName;
51: }
52:
53: public String getTargetDir() {
54: return targetDir;
55: }
56:
57: public boolean areAllAxiomsIntegrityConstraints() {
58: return context == null;
59: }
60:
61: public boolean shouldGenerateOwlapiIris() {
62: return generateOwlapiIris;
63: }
64:
65: public boolean shouldGenerateJavadoc() {
66: return generateJavadoc;
67: }
68:
69: public PropertiesType getPropertiesType() {
70: return propertiesType;
71: }
72:
73: public CliParams getCliParams() {
74: return cliParams;
75: }
76:
77: public static TransformationConfiguration config(CliParams cliParams) {
78: return new TransformationConfiguration(cliParams);
79: }
80:
81: public static TransformationConfigurationBuilder builder() {
82: return new TransformationConfigurationBuilder();
83: }
84:
85: public static class TransformationConfigurationBuilder {
86: private String context;
87: private String packageName = Defaults.PACKAGE;
88: private String targetDir = Defaults.TARGET_DIR;
89: private PropertiesType propertiesType = PropertiesType.valueOf(Defaults.PROPERTIES_TYPE);
90: private boolean owlapiIris = Defaults.WITH_IRIS;
91: private boolean generateJavadoc = Defaults.GENERATE_JAVADOC_FROM_COMMENT;
92:
93: public TransformationConfigurationBuilder context(String context) {
94: this.context = context;
95: return this;
96: }
97:
98: public TransformationConfigurationBuilder packageName(String packageName) {
99: this.packageName = packageName;
100: return this;
101: }
102:
103: public TransformationConfigurationBuilder targetDir(String targetDir) {
104: this.targetDir = targetDir;
105: return this;
106: }
107:
108: public TransformationConfigurationBuilder addOwlapiIris(boolean add) {
109: this.owlapiIris = add;
110: return this;
111: }
112:
113: public TransformationConfigurationBuilder generateJavadoc(boolean javadoc) {
114: this.generateJavadoc = javadoc;
115: return this;
116: }
117:
118: public TransformationConfigurationBuilder propertiesType(PropertiesType propertiesType) {
119: this.propertiesType = propertiesType;
120: return this;
121: }
122:
123: public TransformationConfiguration build() {
124: return new TransformationConfiguration(this);
125: }
126: }
127: }