Skip to content

Package: CollectionAttributeImpl

CollectionAttributeImpl

nameinstructionbranchcomplexitylinemethod
CollectionAttributeImpl(AbstractPluralAttribute.PluralAttributeBuilder)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
builder(PropertyAttributes)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getCollectionType()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
toString()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2024 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.jopa.model.metamodel;
19:
20: import java.util.Collection;
21: import java.util.Set;
22:
23: public class CollectionAttributeImpl<X, V> extends AbstractPluralAttribute<X, Collection<V>, V>
24: implements CollectionAttribute<X, V> {
25:
26: private CollectionAttributeImpl(PluralAttributeBuilder<X, Collection<V>, V> builder) {
27: super(builder);
28: }
29:
30: @Override
31: public CollectionType getCollectionType() {
32: return CollectionType.COLLECTION;
33: }
34:
35: @Override
36: public String toString() {
37: return "CollectionAttribute[" + getName() + "]";
38: }
39:
40: static PluralAttributeBuilder builder(PropertyAttributes config) {
41: return new CollectionAttributeBuilder().collectionType(Set.class).config(config);
42: }
43:
44: static class CollectionAttributeBuilder<X, V> extends PluralAttributeBuilder<X, Collection<V>, V> {
45:
46: @Override
47: public CollectionAttributeImpl<X, V> build() {
48: final CollectionAttributeImpl<X, V> result = new CollectionAttributeImpl<>(this);
49: mappingValidator.validateAttributeMapping(result);
50: return result;
51: }
52: }
53: }