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