Skip to content

Method: getJavaType()

1: /**
2: * Copyright (C) 2020 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.metamodel;
16:
17: import cz.cvut.kbss.jopa.model.annotations.FetchType;
18:
19: import java.lang.reflect.Field;
20:
21: public class IRIIdentifierImpl<T> implements IRIIdentifier {
22:
23: private final ManagedType<T> declaringType;
24: private final Field javaField;
25:
26: private final boolean generated;
27:
28: public IRIIdentifierImpl(ManagedType<T> declaringType, final Field javaField, final boolean generated) {
29: this.declaringType = declaringType;
30: this.javaField = javaField;
31: this.generated = generated;
32: }
33:
34: @Override
35: public ManagedType<T> getDeclaringType() {
36: return declaringType;
37: }
38:
39: @Override
40: public Class getJavaType() {
41: return javaField.getType();
42: }
43:
44: @Override
45: public Field getJavaField() {
46: return javaField;
47: }
48:
49: @Override
50: public FetchType getFetchType() {
51: return FetchType.EAGER;
52: }
53:
54: @Override
55: public boolean isInferred() {
56: return false;
57: }
58:
59: @Override
60: public boolean includeExplicit() {
61: return true;
62: }
63:
64: @Override
65: public String getName() {
66: return javaField.getName();
67: }
68:
69: @Override
70: public boolean isCollection() {
71: return false;
72: }
73:
74: @Override
75: public void accept(IdentifierVisitor i) {
76: i.visit(this);
77: }
78:
79: @Override
80: public boolean isGenerated() {
81: return generated;
82: }
83: }