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