Skip to content

Package: Metamodel

Metamodel

Coverage

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.metamodel;
16:
17: import java.net.URI;
18: import java.util.Set;
19:
20: import cz.cvut.kbss.jopa.UnusedJPA;
21:
22: /**
23: * Provides access to the metamodel of persistent entities in the persistence
24: * unit.
25: */
26: public interface Metamodel {
27: /**
28: * Return the metamodel entity type representing the entity.
29: *
30: * @param cls the type of the represented entity
31: * @return the metamodel entity type
32: * @throws IllegalArgumentException if not an entity
33: */
34: <X> EntityType<X> entity(Class<X> cls);
35:
36: /**
37: * Return the metamodel embeddable type representing the embeddable class.
38: *
39: * @param cls the type of the represented embeddable class
40: * @return the metamodel embeddable type
41: * @throws IllegalArgumentException if not an embeddable class
42: */
43: @UnusedJPA
44: @Deprecated
45: <X> EmbeddableType<X> embeddable(Class<X> cls);
46:
47: /**
48: * Return the metamodel managed types.
49: *
50: * @return the metamodel managed types
51: */
52: Set<ManagedType<?>> getManagedTypes();
53:
54: /**
55: * Return the metamodel entity types.
56: *
57: * @return the metamodel entity types
58: */
59: Set<EntityType<?>> getEntities();
60:
61: /**
62: * Return the metamodel embeddable types. Returns empty set if there are no
63: * embeddable types.
64: *
65: * @return the metamodel embeddable types
66: */
67: @UnusedJPA
68: @Deprecated
69: Set<EmbeddableType<?>> getEmbeddables();
70:
71: /**
72: * Get the set of classes that contain inferred attributes. These classes
73: * are handled specially since inferred attributes can be influenced by
74: * changes to any other attributes in any other entity.
75: *
76: * @return The set of classes with inferred attributes.
77: */
78: Set<Class<?>> getInferredClasses();
79:
80: /**
81: * Gets a set of URIs that should be added to module extraction signature.
82: * <p>
83: * The returned collection is not modifiable.
84: *
85: * @return A set of URIs
86: */
87: Set<URI> getModuleExtractionExtraSignature();
88:
89: /**
90: * Adds the specified URI to the module extraction signature.
91: * <p>
92: * Note that a module including the specified URI will be created when a new
93: * resource level transaction is started. When that will be is
94: * implementation dependent. However it must be guaranteed that all
95: * subsequent connections provided by OntoDriver will include the URI in
96: * extracted modules.
97: *
98: * @param uri The URI to add
99: * @throws NullPointerException If {@code uri} is {@code null}
100: */
101: void addUriToModuleExtractionSignature(URI uri);
102: }