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: @Override
48: public CollectionType getCollectionType() {
49: return CollectionType.LIST;
50: }
51:
52: @Override
53: public IRI getOWLListClass() {
54: return owlListClass;
55: }
56:
57: @Override
58: public IRI getOWLObjectPropertyHasNextIRI() {
59: return owlObjectPropertyHasNext;
60: }
61:
62: @Override
63: public IRI getOWLPropertyHasContentsIRI() {
64: return owlPropertyHasContents;
65: }
66:
67: @Override
68: public SequenceType getSequenceType() {
69: return owlSequenceType;
70: }
71:
72: @Override
73: public String toString() {
74: return "ListAttribute[" + getName() + "]";
75: }
76:
77: public static ListAttributeBuilder iri(IRI iri) {
78: return new ListAttributeBuilder().collectionType(List.class).iri(iri);
79: }
80:
81: public static class ListAttributeBuilder<X, V> extends PluralAttributeBuilder<X, List<V>, V> {
82: private IRI owlListClass;
83: private IRI owlObjectPropertyHasNext;
84: private IRI owlPropertyHasContents;
85: private SequenceType owlSequenceType;
86:
87: @Override
88: public ListAttributeBuilder elementType(Type<V> elementType) {
89: super.elementType(elementType);
90: return this;
91: }
92:
93: @Override
94: public ListAttributeBuilder collectionType(Class<List<V>> collectionType) {
95: super.collectionType(collectionType);
96: return this;
97: }
98:
99: @Override
100: public ListAttributeBuilder field(Field field) {
101: super.field(field);
102: return this;
103: }
104:
105: @Override
106: public ListAttributeBuilder declaringType(ManagedType<X> declaringType) {
107: super.declaringType(declaringType);
108: return this;
109: }
110:
111: @Override
112: public ListAttributeBuilder attributeType(PersistentAttributeType attributeType) {
113: super.attributeType(attributeType);
114: return this;
115: }
116:
117: @Override
118: public ListAttributeBuilder iri(IRI iri) {
119: super.iri(iri);
120: return this;
121: }
122:
123: @Override
124: public ListAttributeBuilder cascadeTypes(CascadeType[] cascadeTypes) {
125: super.cascadeTypes(cascadeTypes);
126: return this;
127: }
128:
129: @Override
130: public ListAttributeBuilder fetchType(FetchType fetchType) {
131: super.fetchType(fetchType);
132: return this;
133: }
134:
135: @Override
136: public ListAttributeBuilder inferred(boolean inferred) {
137: super.inferred(inferred);
138: return this;
139: }
140:
141: @Override
142: public ListAttributeBuilder includeExplicit(boolean includeExplicit) {
143: super.includeExplicit(includeExplicit);
144: return this;
145: }
146:
147: @Override
148: public ListAttributeBuilder readOnly(boolean readOnly) {
149: super.readOnly(readOnly);
150: return this;
151: }
152:
153: @Override
154: public ListAttributeBuilder participationConstraints(ParticipationConstraint[] constraints) {
155: super.participationConstraints(constraints);
156: return this;
157: }
158:
159: public ListAttributeBuilder owlListClass(IRI owlListClass) {
160: this.owlListClass = owlListClass;
161: return this;
162: }
163:
164: public ListAttributeBuilder hasNextProperty(IRI hasNextProperty) {
165: this.owlObjectPropertyHasNext = hasNextProperty;
166: return this;
167: }
168:
169: public ListAttributeBuilder hasContentsProperty(IRI hasContentsProperty) {
170: this.owlPropertyHasContents = hasContentsProperty;
171: return this;
172: }
173:
174: public ListAttributeBuilder sequenceType(SequenceType sequenceType) {
175: this.owlSequenceType = sequenceType;
176: return this;
177: }
178:
179: @Override
180: public ListAttributeImpl<X, V> build() {
181: return new ListAttributeImpl<>(this);
182: }
183: }
184: }