-
Notifications
You must be signed in to change notification settings - Fork 316
/
ValidationContextImpl.java
325 lines (255 loc) · 11 KB
/
ValidationContextImpl.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
318
319
320
321
322
323
324
325
/**
* Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.xtend.core.macro;
import java.io.InputStream;
import java.net.URI;
import java.util.List;
import java.util.Set;
import org.eclipse.xtend.core.macro.declaration.CompilationUnitImpl;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtend.lib.annotations.Delegate;
import org.eclipse.xtend.lib.macro.ValidationContext;
import org.eclipse.xtend.lib.macro.declaration.AnnotationReference;
import org.eclipse.xtend.lib.macro.declaration.Element;
import org.eclipse.xtend.lib.macro.declaration.MutableAnnotationTypeDeclaration;
import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration;
import org.eclipse.xtend.lib.macro.declaration.MutableEnumerationTypeDeclaration;
import org.eclipse.xtend.lib.macro.declaration.MutableInterfaceDeclaration;
import org.eclipse.xtend.lib.macro.declaration.Type;
import org.eclipse.xtend.lib.macro.declaration.TypeReference;
import org.eclipse.xtend.lib.macro.file.FileLocations;
import org.eclipse.xtend.lib.macro.file.FileSystemSupport;
import org.eclipse.xtend.lib.macro.file.Path;
import org.eclipse.xtend.lib.macro.services.AnnotationReferenceBuildContext;
import org.eclipse.xtend.lib.macro.services.AnnotationReferenceProvider;
import org.eclipse.xtend.lib.macro.services.Problem;
import org.eclipse.xtend.lib.macro.services.ProblemSupport;
import org.eclipse.xtend.lib.macro.services.Tracability;
import org.eclipse.xtend.lib.macro.services.TypeLookup;
import org.eclipse.xtend.lib.macro.services.TypeReferenceProvider;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@SuppressWarnings("all")
public class ValidationContextImpl implements ValidationContext {
@Accessors
private CompilationUnitImpl unit;
@Delegate
public ProblemSupport getProblemSupport() {
return this.unit.getProblemSupport();
}
@Delegate
public TypeLookup getTypeLookup() {
return this.unit.getTypeLookup();
}
@Delegate
public TypeReferenceProvider getTypeReferenceProvider() {
return this.unit.getTypeReferenceProvider();
}
@Delegate
public AnnotationReferenceProvider getAnnotationReferenceProvider() {
return this.unit.getAnnotationReferenceProvider();
}
@Delegate
public FileSystemSupport getFileSystemSupport() {
return this.unit.getFileSystemSupport();
}
@Delegate
public FileLocations getFileLocations() {
return this.unit.getFileLocations();
}
@Delegate
public Tracability getTracability() {
return this.unit.getTracability();
}
@Pure
public CompilationUnitImpl getUnit() {
return this.unit;
}
public void setUnit(final CompilationUnitImpl unit) {
this.unit = unit;
}
public void addError(final Element element, final String message) {
this.getProblemSupport().addError(element, message);
}
public void addWarning(final Element element, final String message) {
this.getProblemSupport().addWarning(element, message);
}
public List<? extends Problem> getProblems(final Element element) {
return this.getProblemSupport().getProblems(element);
}
public void validateLater(final Procedure0 arg0) {
this.getProblemSupport().validateLater(arg0);
}
public MutableAnnotationTypeDeclaration findAnnotationType(final String qualifiedName) {
return this.getTypeLookup().findAnnotationType(qualifiedName);
}
public MutableClassDeclaration findClass(final String qualifiedName) {
return this.getTypeLookup().findClass(qualifiedName);
}
public MutableEnumerationTypeDeclaration findEnumerationType(final String qualifiedName) {
return this.getTypeLookup().findEnumerationType(qualifiedName);
}
public MutableInterfaceDeclaration findInterface(final String qualifiedName) {
return this.getTypeLookup().findInterface(qualifiedName);
}
public Type findTypeGlobally(final Class<?> clazz) {
return this.getTypeLookup().findTypeGlobally(clazz);
}
public Type findTypeGlobally(final String typeName) {
return this.getTypeLookup().findTypeGlobally(typeName);
}
public TypeReference getAnyType() {
return this.getTypeReferenceProvider().getAnyType();
}
public TypeReference getList(final TypeReference param) {
return this.getTypeReferenceProvider().getList(param);
}
public TypeReference getObject() {
return this.getTypeReferenceProvider().getObject();
}
public TypeReference getPrimitiveBoolean() {
return this.getTypeReferenceProvider().getPrimitiveBoolean();
}
public TypeReference getPrimitiveByte() {
return this.getTypeReferenceProvider().getPrimitiveByte();
}
public TypeReference getPrimitiveChar() {
return this.getTypeReferenceProvider().getPrimitiveChar();
}
public TypeReference getPrimitiveDouble() {
return this.getTypeReferenceProvider().getPrimitiveDouble();
}
public TypeReference getPrimitiveFloat() {
return this.getTypeReferenceProvider().getPrimitiveFloat();
}
public TypeReference getPrimitiveInt() {
return this.getTypeReferenceProvider().getPrimitiveInt();
}
public TypeReference getPrimitiveLong() {
return this.getTypeReferenceProvider().getPrimitiveLong();
}
public TypeReference getPrimitiveShort() {
return this.getTypeReferenceProvider().getPrimitiveShort();
}
public TypeReference getPrimitiveVoid() {
return this.getTypeReferenceProvider().getPrimitiveVoid();
}
public TypeReference getSet(final TypeReference param) {
return this.getTypeReferenceProvider().getSet(param);
}
public TypeReference getString() {
return this.getTypeReferenceProvider().getString();
}
public TypeReference newArrayTypeReference(final TypeReference componentType) {
return this.getTypeReferenceProvider().newArrayTypeReference(componentType);
}
public TypeReference newSelfTypeReference(final Type typeDeclaration) {
return this.getTypeReferenceProvider().newSelfTypeReference(typeDeclaration);
}
public TypeReference newTypeReference(final Class<?> clazz, final TypeReference... typeArguments) {
return this.getTypeReferenceProvider().newTypeReference(clazz, typeArguments);
}
public TypeReference newTypeReference(final String typeName, final TypeReference... typeArguments) {
return this.getTypeReferenceProvider().newTypeReference(typeName, typeArguments);
}
public TypeReference newTypeReference(final Type typeDeclaration, final TypeReference... typeArguments) {
return this.getTypeReferenceProvider().newTypeReference(typeDeclaration, typeArguments);
}
public TypeReference newWildcardTypeReference() {
return this.getTypeReferenceProvider().newWildcardTypeReference();
}
public TypeReference newWildcardTypeReference(final TypeReference upperBound) {
return this.getTypeReferenceProvider().newWildcardTypeReference(upperBound);
}
public TypeReference newWildcardTypeReferenceWithLowerBound(final TypeReference lowerBound) {
return this.getTypeReferenceProvider().newWildcardTypeReferenceWithLowerBound(lowerBound);
}
public AnnotationReference newAnnotationReference(final AnnotationReference annotationReference) {
return this.getAnnotationReferenceProvider().newAnnotationReference(annotationReference);
}
public AnnotationReference newAnnotationReference(final AnnotationReference arg0, final Procedure1<AnnotationReferenceBuildContext> arg1) {
return this.getAnnotationReferenceProvider().newAnnotationReference(arg0, arg1);
}
public AnnotationReference newAnnotationReference(final Class<?> annotationClass) {
return this.getAnnotationReferenceProvider().newAnnotationReference(annotationClass);
}
public AnnotationReference newAnnotationReference(final Class<?> arg0, final Procedure1<AnnotationReferenceBuildContext> arg1) {
return this.getAnnotationReferenceProvider().newAnnotationReference(arg0, arg1);
}
public AnnotationReference newAnnotationReference(final String annotationTypeName) {
return this.getAnnotationReferenceProvider().newAnnotationReference(annotationTypeName);
}
public AnnotationReference newAnnotationReference(final String arg0, final Procedure1<AnnotationReferenceBuildContext> arg1) {
return this.getAnnotationReferenceProvider().newAnnotationReference(arg0, arg1);
}
public AnnotationReference newAnnotationReference(final Type annotationTypeDelcaration) {
return this.getAnnotationReferenceProvider().newAnnotationReference(annotationTypeDelcaration);
}
public AnnotationReference newAnnotationReference(final Type arg0, final Procedure1<AnnotationReferenceBuildContext> arg1) {
return this.getAnnotationReferenceProvider().newAnnotationReference(arg0, arg1);
}
public boolean exists(final Path path) {
return this.getFileSystemSupport().exists(path);
}
public String getCharset(final Path path) {
return this.getFileSystemSupport().getCharset(path);
}
public Iterable<? extends Path> getChildren(final Path path) {
return this.getFileSystemSupport().getChildren(path);
}
public CharSequence getContents(final Path path) {
return this.getFileSystemSupport().getContents(path);
}
public InputStream getContentsAsStream(final Path path) {
return this.getFileSystemSupport().getContentsAsStream(path);
}
public long getLastModification(final Path path) {
return this.getFileSystemSupport().getLastModification(path);
}
public boolean isFile(final Path path) {
return this.getFileSystemSupport().isFile(path);
}
public boolean isFolder(final Path path) {
return this.getFileSystemSupport().isFolder(path);
}
public URI toURI(final Path path) {
return this.getFileSystemSupport().toURI(path);
}
public Path getProjectFolder(final Path path) {
return this.getFileLocations().getProjectFolder(path);
}
public Set<Path> getProjectSourceFolders(final Path path) {
return this.getFileLocations().getProjectSourceFolders(path);
}
public Path getSourceFolder(final Path path) {
return this.getFileLocations().getSourceFolder(path);
}
public Path getTargetFolder(final Path sourceFolder) {
return this.getFileLocations().getTargetFolder(sourceFolder);
}
public Element getPrimaryGeneratedJavaElement(final Element source) {
return this.getTracability().getPrimaryGeneratedJavaElement(source);
}
public Element getPrimarySourceElement(final Element target) {
return this.getTracability().getPrimarySourceElement(target);
}
public boolean isExternal(final Element element) {
return this.getTracability().isExternal(element);
}
public boolean isGenerated(final Element element) {
return this.getTracability().isGenerated(element);
}
public boolean isSource(final Element element) {
return this.getTracability().isSource(element);
}
public boolean isThePrimaryGeneratedJavaElement(final Element target) {
return this.getTracability().isThePrimaryGeneratedJavaElement(target);
}
}