Skip to content

Method: isCollection()

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 cz.cvut.kbss.jopa.model.annotations.FetchType;
21:
22: import java.lang.reflect.Field;
23: import java.util.Set;
24:
25: public class TypesSpecificationImpl<X, Y> implements TypesSpecification<X, Y> {
26: private final ManagedType<X> declaringType;
27: private final FetchType fetchType;
28: private final Field javaField;
29: private final Class<Y> elementType;
30: private final boolean inferred;
31:
32: public TypesSpecificationImpl(final ManagedType<X> declaringType,
33: final FetchType fetchType, final Field javaField,
34: final Class<Y> elementType, boolean inferred) {
35: this.declaringType = declaringType;
36: this.fetchType = fetchType;
37: this.javaField = javaField;
38: this.elementType = elementType;
39: this.inferred = inferred;
40: }
41:
42: @Override
43: public ManagedType<X> getDeclaringType() {
44: return declaringType;
45: }
46:
47: @Override
48: public FetchType getFetchType() {
49: return fetchType;
50: }
51:
52: @Override
53: public Field getJavaField() {
54: return javaField;
55: }
56:
57: @Override
58: public Class<Set> getJavaType() {
59: return Set.class;
60: }
61:
62: @Override
63: public Class<Y> getElementType() {
64: return elementType;
65: }
66:
67: @Override
68: public boolean isInferred() {
69: return inferred;
70: }
71:
72: @Override
73: public boolean includeExplicit() {
74: // TODO
75: return true;
76: }
77:
78: @Override
79: public String getName() {
80: return javaField.getName();
81: }
82:
83: @Override
84: public boolean isCollection() {
85: return true;
86: }
87: }