Skip to content

Package: AnnotationBuilder

AnnotationBuilder

nameinstructionbranchcomplexitylinemethod
AnnotationBuilder(JAnnotationUse)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getAnnotation()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
visit(DataDomainConstraint)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
visit(DataParticipationConstraint)
M: 21 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
visit(DataRangeConstraint)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
visit(ObjectDomainConstraint)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
visit(ObjectParticipationConstraint)
M: 21 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
visit(ObjectRangeConstraint)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (C) 2016 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.model.ic;
16:
17: import java.lang.annotation.Annotation;
18:
19: import com.sun.codemodel.JAnnotationUse;
20:
21: import cz.cvut.kbss.jopa.model.annotations.DomainOf;
22: import cz.cvut.kbss.jopa.model.annotations.ParticipationConstraint;
23: import cz.cvut.kbss.jopa.model.annotations.RangeOf;
24:
25: public class AnnotationBuilder implements IntegrityConstraintVisitor {
26:
27:         private JAnnotationUse a;
28:
29:         private Annotation annotation = null;
30:         
31:         AnnotationBuilder(final JAnnotationUse a) {
32:                 this.a = a;
33:         }
34:         
35:         public Annotation getAnnotation() {
36:                 return annotation;
37:         }
38:
39:         
40:         public void visit(DataParticipationConstraint cpc) {
41:                 a.annotate(ParticipationConstraint.class).param("owlObjectIRI",
42:                                                 cpc.getObject().getIRI().toString()).param(
43:                                                 "min", cpc.getMin()).param("max", cpc.getMax());
44:         }
45:
46:         
47:         public void visit(ObjectParticipationConstraint cpc) {
48:                 a.annotate(ParticipationConstraint.class).param("owlObjectIRI",
49:                                 cpc.getObject().getIRI().toString()).param(
50:                                 "min", cpc.getMin()).param("max", cpc.getMax());        }
51:
52:         
53:         public void visit(ObjectDomainConstraint cpc) {
54:                 a.annotate(DomainOf.class).param("owlPropertyIRI()",
55:                                 cpc.getProperty().getIRI().toString());
56:         }
57:
58:         
59:         public void visit(ObjectRangeConstraint cpc) {
60:                 a.annotate(RangeOf.class).param("owlPropertyIRI()",
61:                                 cpc.getProperty().getIRI().toString());
62:         }
63:
64:         
65:         public void visit(DataDomainConstraint cpc) {
66:                 a.annotate(DomainOf.class).param("owlPropertyIRI()",
67:                                 cpc.getProperty().getIRI().toString());
68:         }
69:
70:         
71:         public void visit(DataRangeConstraint cpc) {
72:         }
73: }