Skip to content

Package: FieldSpecification

FieldSpecification

Coverage

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.NonJPA;
18: import cz.cvut.kbss.jopa.model.annotations.FetchType;
19:
20: /**
21: * Specifies a field of a managed type.
22: * @param <X> Declaring class
23: * @param <E> Type of the field
24: */
25: public interface FieldSpecification<X, E> {
26:
27: /**
28: * Return the managed type representing the type in which the attribute was
29: * declared.
30: *
31: * @return declaring type
32: */
33: ManagedType<X> getDeclaringType();
34:
35: /**
36: * Return the Java type of the represented attribute.
37: *
38: * @return Java type
39: */
40: Class<E> getJavaType();
41:
42: /**
43: * Return the java.lang.reflect.Member for the represented attribute.
44: *
45: * @return corresponding java.lang.reflect.Member
46: */
47: @NonJPA
48: java.lang.reflect.Field getJavaField();
49:
50: /**
51: * Whether the association is lazily loaded or must be eagerly fetched.
52: *
53: * @return Fetch type of the field specification
54: */
55: @NonJPA
56: FetchType getFetchType();
57:
58: /**
59: * Whether this field can contain inferred data.
60: *
61: * @return Whether field is inferred
62: * @see #includeExplicit()
63: */
64: boolean isInferred();
65:
66: /**
67: * If this field is inferred, can it contain explicit data as well?
68: *
69: * @return Whether inferred field can contain explicit knowledge
70: * @see #isInferred()
71: */
72: boolean includeExplicit();
73:
74: /**
75: * Return the name of the attribute.
76: *
77: * @return name
78: */
79: String getName();
80:
81: /**
82: * Is the attribute collection-valued (represents a Collection, Set, List, or Map).
83: *
84: * @return boolean indicating whether the attribute is collection-valued
85: */
86: boolean isCollection();
87: }