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