Skip to content

Package: ListAttributeImpl$ListAttributeBuilder

ListAttributeImpl$ListAttributeBuilder

nameinstructionbranchcomplexitylinemethod
ListAttributeImpl.ListAttributeBuilder()
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%
attributeType(Attribute.PersistentAttributeType)
M: 0 C: 6
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: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
cascadeTypes(CascadeType[])
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
collectionType(Class)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
declaringType(ManagedType)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
elementType(Type)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
fetchType(FetchType)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
field(Field)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
hasContentsProperty(IRI)
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%
hasNextProperty(IRI)
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%
includeExplicit(boolean)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
inferred(boolean)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
iri(IRI)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
owlListClass(IRI)
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%
participationConstraints(ParticipationConstraint[])
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
readOnly(boolean)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
sequenceType(SequenceType)
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) 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;
16:
17: import cz.cvut.kbss.jopa.model.annotations.CascadeType;
18: import cz.cvut.kbss.jopa.model.annotations.FetchType;
19: import cz.cvut.kbss.jopa.model.annotations.ParticipationConstraint;
20: import cz.cvut.kbss.jopa.model.annotations.SequenceType;
21: import cz.cvut.kbss.jopa.model.metamodel.ListAttribute;
22: import cz.cvut.kbss.jopa.model.metamodel.ManagedType;
23: import cz.cvut.kbss.jopa.model.metamodel.Type;
24:
25: import java.lang.reflect.Field;
26: import java.util.List;
27:
28: public class ListAttributeImpl<X, V> extends PluralAttributeImpl<X, List<V>, V>
29:                 implements ListAttribute<X, V> {
30:
31:         private final IRI owlListClass;
32:
33:         private final IRI owlObjectPropertyHasNext;
34:
35:         private final IRI owlPropertyHasContents;
36:
37:         private final SequenceType owlSequenceType;
38:
39:         public ListAttributeImpl(ListAttributeBuilder<X, V> builder) {
40:                 super(builder);
41:                 this.owlListClass = builder.owlListClass;
42:                 this.owlObjectPropertyHasNext = builder.owlObjectPropertyHasNext;
43:                 this.owlPropertyHasContents = builder.owlPropertyHasContents;
44:                 this.owlSequenceType = builder.owlSequenceType;
45:         }
46:
47:         public CollectionType getCollectionType() {
48:                 return CollectionType.LIST;
49:         }
50:
51:         
52:         public IRI getOWLListClass() {
53:                 return owlListClass;
54:         }
55:
56:         
57:         public IRI getOWLObjectPropertyHasNextIRI() {
58:                 return owlObjectPropertyHasNext;
59:         }
60:
61:         
62:         public IRI getOWLPropertyHasContentsIRI() {
63:                 return owlPropertyHasContents;
64:         }
65:
66:         
67:         public SequenceType getSequenceType() {
68:                 return owlSequenceType;
69:         }
70:
71:         
72:         public String toString() {
73:                 return "ListAttribute[" + getName() + "]";
74:         }
75:
76:         public static ListAttributeBuilder iri(IRI iri) {
77:                 return new ListAttributeBuilder().collectionType(List.class).iri(iri);
78:         }
79:
80:         public static class ListAttributeBuilder<X, V> extends PluralAttributeBuilder<X, List<V>, V> {
81:                 private IRI owlListClass;
82:                 private IRI owlObjectPropertyHasNext;
83:                 private IRI owlPropertyHasContents;
84:                 private SequenceType owlSequenceType;
85:
86:                 @Override
87:                 public ListAttributeBuilder elementType(Type<V> elementType) {
88:                         super.elementType(elementType);
89:                         return this;
90:                 }
91:
92:                 @Override
93:                 public ListAttributeBuilder collectionType(Class<List<V>> collectionType) {
94:                         super.collectionType(collectionType);
95:                         return this;
96:                 }
97:
98:                 @Override
99:                 public ListAttributeBuilder field(Field field) {
100:                         super.field(field);
101:                         return this;
102:                 }
103:
104:                 @Override
105:                 public ListAttributeBuilder declaringType(ManagedType<X> declaringType) {
106:                         super.declaringType(declaringType);
107:                         return this;
108:                 }
109:
110:                 @Override
111:                 public ListAttributeBuilder attributeType(PersistentAttributeType attributeType) {
112:                         super.attributeType(attributeType);
113:                         return this;
114:                 }
115:
116:                 @Override
117:                 public ListAttributeBuilder iri(IRI iri) {
118:                         super.iri(iri);
119:                         return this;
120:                 }
121:
122:                 @Override
123:                 public ListAttributeBuilder cascadeTypes(CascadeType[] cascadeTypes) {
124:                         super.cascadeTypes(cascadeTypes);
125:                         return this;
126:                 }
127:
128:                 @Override
129:                 public ListAttributeBuilder fetchType(FetchType fetchType) {
130:                         super.fetchType(fetchType);
131:                         return this;
132:                 }
133:
134:                 @Override
135:                 public ListAttributeBuilder inferred(boolean inferred) {
136:                         super.inferred(inferred);
137:                         return this;
138:                 }
139:
140:                 @Override
141:                 public ListAttributeBuilder includeExplicit(boolean includeExplicit) {
142:                         super.includeExplicit(includeExplicit);
143:                         return this;
144:                 }
145:
146:                 @Override
147:                 public ListAttributeBuilder readOnly(boolean readOnly) {
148:                         super.readOnly(readOnly);
149:                         return this;
150:                 }
151:
152:                 @Override
153:                 public ListAttributeBuilder participationConstraints(ParticipationConstraint[] constraints) {
154:                         super.participationConstraints(constraints);
155:                         return this;
156:                 }
157:
158:                 public ListAttributeBuilder owlListClass(IRI owlListClass) {
159:                         this.owlListClass = owlListClass;
160:                         return this;
161:                 }
162:
163:                 public ListAttributeBuilder hasNextProperty(IRI hasNextProperty) {
164:                         this.owlObjectPropertyHasNext = hasNextProperty;
165:                         return this;
166:                 }
167:
168:                 public ListAttributeBuilder hasContentsProperty(IRI hasContentsProperty) {
169:                         this.owlPropertyHasContents = hasContentsProperty;
170:                         return this;
171:                 }
172:
173:                 public ListAttributeBuilder sequenceType(SequenceType sequenceType) {
174:                         this.owlSequenceType = sequenceType;
175:                         return this;
176:                 }
177:
178:                 public ListAttributeImpl<X, V> build() {
179:                         return new ListAttributeImpl<>(this);
180:                 }
181:         }
182: }