Skip to content

Method: getJavaType()

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.FetchType;
18: import cz.cvut.kbss.jopa.model.metamodel.ManagedType;
19: import cz.cvut.kbss.jopa.model.metamodel.TypesSpecification;
20:
21: import java.lang.reflect.Field;
22:
23: public class TypesSpecificationImpl<X, Y> implements
24: TypesSpecification<X, Y> {
25: private final ManagedType<X> declaringType;
26: private final FetchType fetchType;
27: private final Field javaField;
28: private Class<Y> javaType;
29: private boolean inferred;
30:
31: public TypesSpecificationImpl(final ManagedType<X> declaringType,
32: final FetchType fetchType, final Field javaField,
33: final Class<Y> javaType, boolean inferred) {
34:
35: this.declaringType = declaringType;
36: this.fetchType = fetchType;
37: this.javaField = javaField;
38: this.javaType = javaType;
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<Y> getJavaType() {
59: return javaType;
60: }
61:
62: @Override
63: public boolean isInferred() {
64: return inferred;
65: }
66:
67: @Override
68: public boolean includeExplicit() {
69: // TODO
70: return true;
71: }
72:
73: @Override
74: public boolean isReadOnly() {
75: // TODO
76: return false;
77: }
78:
79: @Override
80: public String getName() {
81: return javaField.getName();
82: }
83: }