-
Notifications
You must be signed in to change notification settings - Fork 3
/
IEPackageProvider.java
317 lines (286 loc) · 11 KB
/
IEPackageProvider.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/*******************************************************************************
* Copyright (c) 2015, 2024 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.acceleo.query.runtime;
import java.util.Collection;
import java.util.Set;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
/**
* Provides {@link EPackage} in the {@link IReadOnlyQueryEnvironment}.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
* @noimplements This interface is not designed to be implemented outside of AQL.
*/
public interface IEPackageProvider {
/**
* Returns the {@link Collection} of {@link EPackage} registered with the specified name.
*
* @param name
* the name of the requested package.
* @return the {@link Collection} of {@link EPackage} registered with the specified name
* @since 8.0.2
*/
Set<EPackage> getEPackage(String name);
/**
* the classifier with the specified name in the package registered with the specified name.
*
* @param name
* the name of the searched classifier's package
* @param classifierName
* the name of the searched classifier
* @return the list of classifiers matching the given {@link EClassifier} and {@link EPackage} names.
* @since 8.0.2
*/
Set<EClassifier> getTypes(String name, String classifierName);
/**
* the list of classifiers known to the package provider with the specified name.
*
* @param name
* the name of the searched classifier
* @return the list of classifiers matching the given {@link EClassifier} names.
* @since 8.0.2
*/
Set<EClassifier> getTypes(String name);
/**
* the classifier with the specified name in the package registered with the specified name.
*
* @param name
* the name of the searched classifier's package
* @param classifierName
* the name of the searched classifier
* @return the classifier with the specified name in the package registered with the specified name.
* @deprecated you should use the getTypes(...) method which consider that there might be several EClasses
* sharing the same name.
*/
@Deprecated
EClassifier getType(String name, String classifierName);
/**
* Returns an {@link EClassifier} instance when a unique one is found in all the registered packages. If
* several are found, returns <code>null</code> and log a warning.
*
* @param classifierName
* the name of the search classifier.
* @return the requested classifier unless several classifiers have the same name in different packages.
*/
@Deprecated
EClassifier getType(String classifierName);
/**
* Returns the {@link EEnumLiteral} with the specified name in the specified enum.
*
* @param packageName
* the name of the package where to search the {@link EEnumLiteral}
* @param enumName
* the name of the {@link org.eclipse.emf.ecore.EEnum EEnum} containing the literal.
* @param literalName
* the name of the searched {@link EEnumLiteral}.
* @return the list of {@link EEnumLiteral} instances matching the given {@link EPackage},
* {@link org.eclipse.emf.ecore.EEnum EEnum} and {@link EEnumLiteral} names.
* @since 4.1
*/
Collection<EEnumLiteral> getEnumLiterals(String packageName, String enumName, String literalName);
/**
* Returns the {@link EEnumLiteral} with the specified name in the specified enum.
*
* @param packageName
* the name of the package where to search the {@link EEnumLiteral}
* @param enumName
* the name of the {@link org.eclipse.emf.ecore.EEnum EEnum} containing the literal.
* @param literalName
* the name of the searched {@link EEnumLiteral}.
* @return the specified {@link EEnumLiteral}
* @deprecated you should use the getEnumLiterals(...) method which consider that there might be several
* EnumLiterals sharing the same name.
*/
@Deprecated
EEnumLiteral getEnumLiteral(String packageName, String enumName, String literalName);
/**
* Returns the {@link EEnumLiteral} with the specified name in the specified enum if it exists in one of
* the registered package. Returns <code>null</code> otherwise.
*
* @param enumName
* the name of the {@link org.eclipse.emf.ecore.EEnum EEnum} containing the literal.
* @param literalName
* the name of the searched {@link EEnumLiteral}.
* @return the specified {@link EEnumLiteral}
*/
@Deprecated
EEnumLiteral getEnumLiteral(String enumName, String literalName);
/**
* Gets the {@link EClassifier} represented by the given {@link Class}.
*
* @param cls
* the {@link Class}
* @return the {@link EClassifier} represented by the given {@link Class} if any, <code>null</code>
* otherwise
* @since 5.0
*/
Set<EClassifier> getEClassifiers(Class<?> cls);
/**
* Gets the {@link EClassifier} represented by the given {@link Class} {@link Class#getCanonicalName()
* canonical name}.
*
* @param clsName
* the {@link Class} qualified name
* @return the {@link EClassifier} represented by the given {@link Class} {@link Class#getCanonicalName()
* canonical name} if any, <code>null</code> otherwise
* @since 8.0.2
*/
Set<EClassifier> getEClassifiers(String clsName);
/**
* Gets the {@link Class} of instance of the given {@link EClassifier}.
*
* @param eCls
* the {@link EClassifier}
* @return the {@link Class} of instance of the given {@link EClassifier} if any, <code>null</code>
* otherwise
*/
Class<?> getClass(EClassifier eCls);
/**
* Checks whether the given EClassifier has been registered in this package provider.
*
* @param eCls
* The EClassifier to check.
* @return <code>true</code> if this classifier has been registered in this package provider,
* <code>false</code> otherwise.
* @since 4.1
*/
boolean isRegistered(EClassifier eCls);
/**
* Gets the {@link Set} of registered {@link EPackage}.
*
* @return the {@link Set} of registered {@link EPackage}
* @since 4.0.0
*/
Set<EPackage> getRegisteredEPackages();
/**
* Gets the {@link EStructuralFeature} from the given {@link Set} of {@link EClass}.
*
* @param receiverEClasses
* the {@link Set} of {@link EClass}.
* @return the {@link EStructuralFeature} from the given {@link Set} of {@link EClass}
*/
Set<EStructuralFeature> getEStructuralFeatures(Set<EClass> receiverEClasses);
/**
* Gets the {@link Set} of {@link IQueryEnvironment#registerEPackage(EPackage) registered}
* {@link EClassifier}.
*
* @return the {@link Set} of {@link IQueryEnvironment#registerEPackage(EPackage) registered}
* {@link EClassifier}
*/
Set<EClassifier> getEClassifiers();
/**
* Gets the {@link Set} of {@link IQueryEnvironment#registerEPackage(EPackage) registered}
* {@link EEnumLiteral}.
*
* @return the {@link Set} of {@link IQueryEnvironment#registerEPackage(EPackage) registered}
* {@link EEnumLiteral}
*/
Set<EEnumLiteral> getEEnumLiterals();
/**
* Gets the {@link Set} of {@link EClass} that can directly contain in the given {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of {@link EClass} that can directly contain in the given {@link EClass}
*/
Set<EClass> getContainingEClasses(EClass eCls);
/**
* Gets the {@link Set} of {@link EClass} that can directly and indirectly contain in the given
* {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of {@link EClass} that can directly and indirectly contain in the given
* {@link EClass}
*/
Set<EClass> getAllContainingEClasses(EClass eCls);
/**
* Gets all sub types for the given {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return all sub types for the given {@link EClass}
*/
Set<EClass> getAllSubTypes(EClass eCls);
/**
* Gets the {@link Set} of {@link EClass} that can be directly contained in the given {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of {@link EClass} that can be directly contained in the given {@link EClass}
*/
Set<EClass> getContainedEClasses(EClass eCls);
/**
* Gets the {@link Set} of {@link EClass} that can be directly and indirectly contained in the given
* {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of {@link EClass} that can be directly and indirectly contained in the given
* {@link EClass}
*/
Set<EClass> getAllContainedEClasses(EClass eCls);
/**
* Gets the {@link Set} of {@link EClass} that can directly reference the given {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of {@link EClass} that can directly reference in the given {@link EClass}
*/
Set<EClass> getInverseEClasses(EClass eCls);
/**
* Gets the {@link Set} of {@link EClass} that can be following siblings of the given {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of {@link EClass} that can be following siblings of the given {@link EClass}
*/
Set<EClass> getFollowingSiblingsEClasses(EClass eCls);
/**
* Gets the {@link Set} of {@link EClass} that can be preceding siblings of the given {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of {@link EClass} that can be preceding siblings of the given {@link EClass}
*/
Set<EClass> getPrecedingSiblingsEClasses(EClass eCls);
/**
* Gets the {@link Set} of {@link EClassifier} that can be siblings of the given {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of {@link EClassifier} that can be siblings of the given {@link EClass}
*/
Set<EClass> getSiblingsEClasses(EClass eCls);
/**
* Gets the {@link Set} of containing {@link EStructuralFeature} for the given {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of containing {@link EStructuralFeature} for the given {@link EClass}
* @since 4.1
*/
Set<EStructuralFeature> getContainingEStructuralFeatures(EClass eCls);
/**
* Gets the {@link Set} of all containing {@link EStructuralFeature} transitively for the given
* {@link EClass}.
*
* @param eCls
* the {@link EClass}
* @return the {@link Set} of all containing {@link EStructuralFeature} transitively for the given
* {@link EClass}
* @since 4.1
*/
Set<EStructuralFeature> getAllContainingEStructuralFeatures(EClass eCls);
}