KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > reflect > CoreFactory


1 package spoon.reflect;
2
3 import java.io.File JavaDoc;
4 import java.lang.annotation.Annotation JavaDoc;
5
6 import spoon.reflect.code.CtArrayAccess;
7 import spoon.reflect.code.CtAssert;
8 import spoon.reflect.code.CtAssignment;
9 import spoon.reflect.code.CtBinaryOperator;
10 import spoon.reflect.code.CtBlock;
11 import spoon.reflect.code.CtBreak;
12 import spoon.reflect.code.CtCase;
13 import spoon.reflect.code.CtCatch;
14 import spoon.reflect.code.CtConditional;
15 import spoon.reflect.code.CtContinue;
16 import spoon.reflect.code.CtDo;
17 import spoon.reflect.code.CtExpression;
18 import spoon.reflect.code.CtFieldAccess;
19 import spoon.reflect.code.CtFor;
20 import spoon.reflect.code.CtForEach;
21 import spoon.reflect.code.CtIf;
22 import spoon.reflect.code.CtInvocation;
23 import spoon.reflect.code.CtLiteral;
24 import spoon.reflect.code.CtLocalVariable;
25 import spoon.reflect.code.CtNewArray;
26 import spoon.reflect.code.CtNewClass;
27 import spoon.reflect.code.CtOperatorAssignment;
28 import spoon.reflect.code.CtReturn;
29 import spoon.reflect.code.CtStatementList;
30 import spoon.reflect.code.CtSwitch;
31 import spoon.reflect.code.CtSynchronized;
32 import spoon.reflect.code.CtThrow;
33 import spoon.reflect.code.CtTry;
34 import spoon.reflect.code.CtUnaryOperator;
35 import spoon.reflect.code.CtVariableAccess;
36 import spoon.reflect.code.CtWhile;
37 import spoon.reflect.declaration.CtAnnotation;
38 import spoon.reflect.declaration.CtAnnotationType;
39 import spoon.reflect.declaration.CtAnonymousExecutable;
40 import spoon.reflect.declaration.CtClass;
41 import spoon.reflect.declaration.CtConstructor;
42 import spoon.reflect.declaration.CtEnum;
43 import spoon.reflect.declaration.CtField;
44 import spoon.reflect.declaration.CtInterface;
45 import spoon.reflect.declaration.CtMethod;
46 import spoon.reflect.declaration.CtPackage;
47 import spoon.reflect.declaration.CtParameter;
48 import spoon.reflect.declaration.CtTypeParameter;
49 import spoon.reflect.declaration.SourcePosition;
50 import spoon.reflect.reference.CtArrayTypeReference;
51 import spoon.reflect.reference.CtExecutableReference;
52 import spoon.reflect.reference.CtFieldReference;
53 import spoon.reflect.reference.CtLocalVariableReference;
54 import spoon.reflect.reference.CtPackageReference;
55 import spoon.reflect.reference.CtParameterReference;
56 import spoon.reflect.reference.CtTypeParameterReference;
57 import spoon.reflect.reference.CtTypeReference;
58
59 /**
60  * This interface defines the core creation methods for the meta-model (to be
61  * implemented so that Spoon can manipulate other meta-model implementations).
62  * <p>
63  * <b>Important</b>: a required post-condition for all the created elements is
64  * that the factory (see {@link spoon.processing.FactoryAccessor#getFactory()})
65  * is correctly initialized with the main factory returned by
66  * {@link #getMainFactory()}, which cannot be null.
67  */

68 public interface CoreFactory {
69
70     /**
71      * Recursively clones a given element of the metamodel and all its child
72      * elements.
73      *
74      * @param <T>
75      * the element's type
76      * @param element
77      * the element
78      * @return a clone of <code>element</code>
79      */

80     <T> T clone(T element);
81
82     /**
83      * Creates an annotation.
84      */

85     <A extends Annotation JavaDoc> CtAnnotation<A> createAnnotation();
86
87     /**
88      * Creates an annotation type.
89      */

90     <T extends Annotation JavaDoc> CtAnnotationType<T> createAnnotationType();
91
92     /**
93      * Creates an anonymous executable.
94      */

95     CtAnonymousExecutable createAnonymousExecutable();
96
97     /**
98      * Creates an array access expression.
99      */

100     <T, E extends CtExpression<?>> CtArrayAccess<T, E> createArrayAccess();
101
102     /**
103      * Creates an array type reference.
104      */

105     <T> CtArrayTypeReference<T> createArrayTypeReference();
106
107     /**
108      * Creates an <code>assert</code> statement.
109      */

110     CtAssert createAssert();
111
112     /**
113      * Creates an assignment expression.
114      */

115     <T, A extends T> CtAssignment<T, A> createAssignment();
116
117     /**
118      * Creates a binary operator.
119      */

120     <T> CtBinaryOperator<T> createBinaryOperator();
121
122     /**
123      * Creates a block.
124      */

125     <R> CtBlock<R> createBlock();
126
127     /**
128      * Creates a <code>break</code> statement.
129      */

130     CtBreak createBreak();
131
132     /**
133      * Creates a <code>case</code> clause.
134      */

135     <S> CtCase<S> createCase();
136
137     /**
138      * Creates a <code>catch</code> clause.
139      */

140     CtCatch createCatch();
141
142     /**
143      * Creates a class.
144      */

145     <T> CtClass<T> createClass();
146
147     /**
148      * Creates a conditional expression (<code>boolExpr?ifTrue:ifFalse</code>).
149      */

150     <T> CtConditional<T> createConditional();
151
152     /**
153      * Creates a constructor.
154      */

155     <T> CtConstructor<T> createConstructor();
156
157     /**
158      * Creates a <code>continue</code> statement.
159      */

160     CtContinue createContinue();
161
162     /**
163      * Creates a <code>do</code> loop.
164      */

165     CtDo createDo();
166
167     /**
168      * Creates an enum.
169      */

170     <T extends Enum JavaDoc> CtEnum<T> createEnum();
171
172     /**
173      * Creates an executable reference.
174      */

175     <T> CtExecutableReference<T> createExecutableReference();
176
177     /**
178      * Creates a field.
179      */

180     <T> CtField<T> createField();
181
182     /**
183      * Creates a field access expression.
184      */

185     <T> CtFieldAccess<T> createFieldAccess();
186
187     /**
188      * Creates a field reference.
189      */

190     <T> CtFieldReference<T> createFieldReference();
191
192     /**
193      * Creates a <code>for</code> loop.
194      */

195     CtFor createFor();
196
197     /**
198      * Creates a <code>foreach</code> loop.
199      */

200     CtForEach createForEach();
201
202     /**
203      * Creates an <code>if</code> statement.
204      */

205     CtIf createIf();
206
207     /**
208      * Creates an interface.
209      */

210     <T> CtInterface<T> createInterface();
211
212     /**
213      * Creates an invocation expression.
214      */

215     <T> CtInvocation<T> createInvocation();
216
217     /**
218      * Creates a literal expression.
219      */

220     <T> CtLiteral<T> createLiteral();
221
222     /**
223      * Creates a local variable declaration statement.
224      */

225     <T> CtLocalVariable<T> createLocalVariable();
226
227     /**
228      * Creates a local variable reference.
229      */

230     <T> CtLocalVariableReference<T> createLocalVariableReference();
231
232     /**
233      * Creates a method.
234      */

235     <T> CtMethod<T> createMethod();
236
237     /**
238      * Creates a new array expression.
239      */

240     <T> CtNewArray<T> createNewArray();
241
242     /**
243      * Creates a new anonymous class expression.
244      */

245     <T> CtNewClass<T> createNewClass();
246
247     /**
248      * Creates a new operator assignement (like +=).
249      */

250     <T, A extends T> CtOperatorAssignment<T, A> createOperatorAssignment();
251
252     /**
253      * Creates a package.
254      */

255     CtPackage createPackage();
256
257     /**
258      * Creates a package reference.
259      */

260     CtPackageReference createPackageReference();
261
262     /**
263      * Creates a parameter.
264      */

265     <T> CtParameter<T> createParameter();
266
267     /**
268      * Creates a parameter reference.
269      */

270     <T> CtParameterReference<T> createParameterReference();
271
272     /**
273      * Creates a <code>return</code> statement.
274      */

275     <R> CtReturn<R> createReturn();
276
277     /**
278      * Creates a source position.
279      */

280     SourcePosition createSourcePosition(File JavaDoc sourceFileName, int start,
281             int end, int[] lineSeparatorPositions);
282
283     /**
284      * Creates a statement list.
285      */

286     <R> CtStatementList<R> createStatementList();
287
288     /**
289      * Creates a <code>switch</code> statement.
290      */

291     <S> CtSwitch<S> createSwitch();
292
293     /**
294      * Creates a <code>synchronized</code> statement.
295      */

296     CtSynchronized createSynchronized();
297
298     /**
299      * Creates a <code>throw</code> statement.
300      */

301     CtThrow createThrow();
302
303     /**
304      * Creates a <code>try</code> block.
305      */

306     CtTry createTry();
307
308     /**
309      * Creates a type parameter.
310      */

311     CtTypeParameter createTypeParameter();
312
313     /**
314      * Creates a type parameter reference.
315      */

316     CtTypeParameterReference createTypeParameterReference();
317
318     /**
319      * Creates a type reference.
320      */

321     <T> CtTypeReference<T> createTypeReference();
322
323     /**
324      * Creates a unary operator expression.
325      */

326     <T> CtUnaryOperator<T> createUnaryOperator();
327
328     /**
329      * Creates a variable access expression.
330      */

331     <T> CtVariableAccess<T> createVariableAccess();
332
333     /**
334      * Creates a <code>while</code> loop.
335      */

336     CtWhile createWhile();
337
338     /**
339      * Gets the main factory of that core factory (cannot be <code>null</code>).
340      */

341     Factory getMainFactory();
342
343     /**
344      * Sets the main factory of that core factory.
345      */

346     void setMainFactory(Factory mainFactory);
347
348 }
349
Popular Tags