Skip to content

Method: SetAttributeImpl.SetAttributeBuilder()

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