KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > CodeGeneration


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  * John Kaplan, johnkaplantech@gmail.com - 108071 [code templates] template for body of newly created class
11  *******************************************************************************/

12 package org.eclipse.jdt.ui;
13
14 import org.eclipse.core.runtime.CoreException;
15
16 import org.eclipse.jdt.core.ICompilationUnit;
17 import org.eclipse.jdt.core.IMethod;
18 import org.eclipse.jdt.core.dom.IMethodBinding;
19 import org.eclipse.jdt.core.dom.MethodDeclaration;
20
21 import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
22 import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContextType;
23
24 /**
25  * Class that offers access to the templates contained in the 'code templates' preference page.
26  *
27  * @since 2.1
28  */

29 public class CodeGeneration {
30
31     
32     /**
33      * Constant ID for the type kind to be used in {@link #getTypeBody(String, ICompilationUnit, String, String)} to get the code template used
34      * for a new class type body.
35      * @since 3.2
36      */

37     public static final String JavaDoc CLASS_BODY_TEMPLATE_ID= CodeTemplateContextType.CLASSBODY_ID;
38     
39     /**
40      * Constant ID for the type kind to be used in {@link #getTypeBody(String, ICompilationUnit, String, String)} to get the code template used
41      * for a new interface type body.
42      * @since 3.2
43      */

44     public static final String JavaDoc INTERFACE_BODY_TEMPLATE_ID= CodeTemplateContextType.INTERFACEBODY_ID;
45     
46     /**
47      * Constant ID for the type kind to be used in {@link #getTypeBody(String, ICompilationUnit, String, String)} to get the code template used
48      * for a new enum type body.
49      * @since 3.2
50      */

51     public static final String JavaDoc ENUM_BODY_TEMPLATE_ID= CodeTemplateContextType.ENUMBODY_ID;
52     
53     /**
54      * Constant ID for the type kind to be used in {@link #getTypeBody(String, ICompilationUnit, String, String)} to get the code template used
55      * for a new annotation type body.
56      * @since 3.2
57      */

58     public static final String JavaDoc ANNOTATION_BODY_TEMPLATE_ID= CodeTemplateContextType.ANNOTATIONBODY_ID;
59     
60     private static final String JavaDoc[] EMPTY= new String JavaDoc[0];
61     
62     private CodeGeneration() {
63     }
64     
65     /**
66      * Returns the content for a new compilation unit using the 'new Java file' code template.
67      * @param cu The compilation unit to create the source for. The compilation unit does not need to exist.
68      * @param typeComment The comment for the type to be created. Used when the code template contains a <i>${typecomment}</i> variable. Can be <code>null</code> if
69      * no comment should be added.
70      * @param typeContent The code of the type, including type declaration and body.
71      * @param lineDelimiter The line delimiter to be used.
72      * @return Returns the new content or <code>null</code> if the template is undefined or empty.
73      * @throws CoreException Thrown when the evaluation of the code template fails.
74      */

75     public static String JavaDoc getCompilationUnitContent(ICompilationUnit cu, String JavaDoc typeComment, String JavaDoc typeContent, String JavaDoc lineDelimiter) throws CoreException {
76         return getCompilationUnitContent(cu, getFileComment(cu, lineDelimiter), typeComment, typeContent, lineDelimiter);
77     }
78     
79     /**
80      * Returns the content for a new compilation unit using the 'new Java file' code template.
81      * @param cu The compilation unit to create the source for. The compilation unit does not need to exist.
82      * @param fileComment The file comment to be used when the code template contains a <i>${filecomment}</i> variable. Can be <code>null</code> if
83      * no comment should be added.
84      * @param typeComment The comment for the type to be created. Used when the code template contains a <i>${typecomment}</i> variable. Can be <code>null</code> if
85      * no comment should be added.
86      * @param typeContent The code of the type, including type declaration and body.
87      * @param lineDelimiter The line delimiter to be used.
88      * @return Returns the new content or <code>null</code> if the template is undefined or empty.
89      * @throws CoreException Thrown when the evaluation of the code template fails.
90      * @since 3.1
91      */

92     public static String JavaDoc getCompilationUnitContent(ICompilationUnit cu, String JavaDoc fileComment, String JavaDoc typeComment, String JavaDoc typeContent, String JavaDoc lineDelimiter) throws CoreException {
93         return StubUtility.getCompilationUnitContent(cu, fileComment, typeComment, typeContent, lineDelimiter);
94     }
95     
96     /**
97      * Returns the content for a new file comment using the 'file comment' code template. The returned content is unformatted and is not indented.
98      * @param cu The compilation unit to add the comment to. The compilation unit does not need to exist.
99      * @param lineDelimiter The line delimiter to be used.
100      * @return Returns the new content or <code>null</code> if the code template is undefined or empty. The returned content is unformatted and is not indented.
101      * @throws CoreException Thrown when the evaluation of the code template fails.
102      * @since 3.1
103      */

104     public static String JavaDoc getFileComment(ICompilationUnit cu, String JavaDoc lineDelimiter) throws CoreException {
105         return StubUtility.getFileComment(cu, lineDelimiter);
106     }
107     
108     /**
109      * Returns the content for a new type comment using the 'type comment' code template. The returned content is unformatted and is not indented.
110      * @param cu The compilation unit where the type is contained. The compilation unit does not need to exist.
111      * @param typeQualifiedName The name of the type to which the comment is added. For inner types the name must be qualified and include the outer
112      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
113      * @param lineDelimiter The line delimiter to be used.
114      * @return Returns the new content or <code>null</code> if the code template is undefined or empty. The returned content is unformatted and is not indented.
115      * @throws CoreException Thrown when the evaluation of the code template fails.
116      */

117     public static String JavaDoc getTypeComment(ICompilationUnit cu, String JavaDoc typeQualifiedName, String JavaDoc lineDelimiter) throws CoreException {
118         return StubUtility.getTypeComment(cu, typeQualifiedName, EMPTY, lineDelimiter);
119     }
120     
121     /**
122      * Returns the content for a new type comment using the 'type comment' code template. The returned content is unformatted and is not indented.
123      * @param cu The compilation unit where the type is contained. The compilation unit does not need to exist.
124      * @param typeQualifiedName The name of the type to which the comment is added. For inner types the name must be qualified and include the outer
125      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
126      * @param typeParameterNames The type parameter names
127      * @param lineDelimiter The line delimiter to be used.
128      * @return Returns the new content or <code>null</code> if the code template is undefined or empty. The returned content is unformatted and is not indented.
129      * @throws CoreException Thrown when the evaluation of the code template fails.
130      * @since 3.1
131      */

132     public static String JavaDoc getTypeComment(ICompilationUnit cu, String JavaDoc typeQualifiedName, String JavaDoc[] typeParameterNames, String JavaDoc lineDelimiter) throws CoreException {
133         return StubUtility.getTypeComment(cu, typeQualifiedName, typeParameterNames, lineDelimiter);
134     }
135         
136     /**
137      * Returns the content of a new new type body using the 'type body' code templates. The returned content is unformatted and is not indented.
138      * @param typeKind The type kind ID of the body template. Valid values are {@link #CLASS_BODY_TEMPLATE_ID}, {@link #INTERFACE_BODY_TEMPLATE_ID},
139      * {@link #ENUM_BODY_TEMPLATE_ID} and {@link #ANNOTATION_BODY_TEMPLATE_ID}.
140      * @param cu The compilation unit where the type is contained. The compilation unit does not need to exist.
141      * @param typeName The name of the type(for embedding in the template as a user variable).
142      * @param lineDelim The line delimiter to be used.
143      * @return Returns the new content or <code>null</code> if the code template is undefined or empty. The returned content is unformatted and is not indented.
144      * @throws CoreException Thrown when the evaluation of the code template fails.
145      * @since 3.2
146      */

147     public static String JavaDoc getTypeBody(String JavaDoc typeKind, ICompilationUnit cu, String JavaDoc typeName, String JavaDoc lineDelim) throws CoreException {
148         return StubUtility.getTypeBody(typeKind, cu, typeName, lineDelim);
149     }
150
151     /**
152      * Returns the content for a new field comment using the 'field comment' code template. The returned content is unformatted and is not indented.
153      * @param cu The compilation unit where the field is contained. The compilation unit does not need to exist.
154      * @param typeName The name of the field declared type.
155      * @param fieldName The name of the field to which the comment is added.
156      * @param lineDelimiter The line delimiter to be used.
157      * @return Returns the new content or <code>null</code> if the code template is undefined or empty. The returned content is unformatted and is not indented.
158      * @throws CoreException Thrown when the evaluation of the code template fails.
159      * @since 3.0
160      */

161     public static String JavaDoc getFieldComment(ICompilationUnit cu, String JavaDoc typeName, String JavaDoc fieldName, String JavaDoc lineDelimiter) throws CoreException {
162         return StubUtility.getFieldComment(cu, typeName, fieldName, lineDelimiter);
163     }
164     
165     /**
166      * Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).
167      * <code>null</code> is returned if the template is empty.
168      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
169      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
170      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
171      * @param decl The MethodDeclaration AST node that will be added as new
172      * method. The node does not need to exist in an AST (no parent needed) and does not need to resolve.
173      * See {@link org.eclipse.jdt.core.dom.AST#newMethodDeclaration()} for how to create such a node.
174      * @param overridden The binding of the method to which to add an "@see" link or
175      * <code>null</code> if no link should be created.
176      * @param lineDelimiter The line delimiter to be used.
177      * @return Returns the generated method comment or <code>null</code> if the
178      * code template is empty. The returned content is unformatted and not indented (formatting required).
179      * @throws CoreException Thrown when the evaluation of the code template fails.
180      */

181     public static String JavaDoc getMethodComment(ICompilationUnit cu, String JavaDoc declaringTypeName, MethodDeclaration decl, IMethodBinding overridden, String JavaDoc lineDelimiter) throws CoreException {
182         if (overridden != null) {
183             overridden= overridden.getMethodDeclaration();
184             String JavaDoc declaringClassQualifiedName= overridden.getDeclaringClass().getQualifiedName();
185             String JavaDoc linkToMethodName= overridden.getName();
186             String JavaDoc[] parameterTypesQualifiedNames= StubUtility.getParameterTypeNamesForSeeTag(overridden);
187             return StubUtility.getMethodComment(cu, declaringTypeName, decl, overridden.isDeprecated(), linkToMethodName, declaringClassQualifiedName, parameterTypesQualifiedNames, false, lineDelimiter);
188         } else {
189             return StubUtility.getMethodComment(cu, declaringTypeName, decl, false, null, null, null, false, lineDelimiter);
190         }
191     }
192
193     /**
194      * Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).
195      * <code>null</code> is returned if the template is empty.
196      * <p>The returned string is unformatted and not indented.
197      * <p>Exception types and return type are in signature notation. e.g. a source method declared as <code>public void foo(String text, int length)</code>
198      * would return the array <code>{"QString;","I"}</code> as parameter types. See {@link org.eclipse.jdt.core.Signature}.
199      *
200      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
201      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
202      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
203      * @param methodName Name of the method.
204      * @param paramNames Names of the parameters for the method.
205      * @param excTypeSig Thrown exceptions (Signature notation).
206      * @param retTypeSig Return type (Signature notation) or <code>null</code>
207      * for constructors.
208      * @param overridden The method that will be overridden by the created method or
209      * <code>null</code> for non-overriding methods. If not <code>null</code>, the method must exist.
210      * @param lineDelimiter The line delimiter to be used.
211      * @return Returns the constructed comment or <code>null</code> if
212      * the comment code template is empty. The returned content is unformatted and not indented (formatting required).
213      * @throws CoreException Thrown when the evaluation of the code template fails.
214      */

215     public static String JavaDoc getMethodComment(ICompilationUnit cu, String JavaDoc declaringTypeName, String JavaDoc methodName, String JavaDoc[] paramNames, String JavaDoc[] excTypeSig, String JavaDoc retTypeSig, IMethod overridden, String JavaDoc lineDelimiter) throws CoreException {
216         return StubUtility.getMethodComment(cu, declaringTypeName, methodName, paramNames, excTypeSig, retTypeSig, EMPTY, overridden, false, lineDelimiter);
217     }
218     
219     /**
220      * Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).
221      * <code>null</code> is returned if the template is empty.
222      * <p>The returned string is unformatted and not indented.
223      * <p>Exception types and return type are in signature notation. e.g. a source method declared as <code>public void foo(String text, int length)</code>
224      * would return the array <code>{"QString;","I"}</code> as parameter types. See {@link org.eclipse.jdt.core.Signature}.
225      *
226      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
227      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
228      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
229      * @param methodName Name of the method.
230      * @param paramNames Names of the parameters for the method.
231      * @param excTypeSig Thrown exceptions (Signature notation).
232      * @param retTypeSig Return type (Signature notation) or <code>null</code>
233      * for constructors.
234      * @param typeParameterNames Names of the type parameters for the method.
235      * @param overridden The method that will be overridden by the created method or
236      * <code>null</code> for non-overriding methods. If not <code>null</code>, the method must exist.
237      * @param lineDelimiter The line delimiter to be used.
238      * @return Returns the constructed comment or <code>null</code> if
239      * the comment code template is empty. The returned content is unformatted and not indented (formatting required).
240      * @throws CoreException Thrown when the evaluation of the code template fails.
241      * @since 3.1
242      */

243     public static String JavaDoc getMethodComment(ICompilationUnit cu, String JavaDoc declaringTypeName, String JavaDoc methodName, String JavaDoc[] paramNames, String JavaDoc[] excTypeSig, String JavaDoc retTypeSig, String JavaDoc[] typeParameterNames, IMethod overridden, String JavaDoc lineDelimiter) throws CoreException {
244         return StubUtility.getMethodComment(cu, declaringTypeName, methodName, paramNames, excTypeSig, retTypeSig, typeParameterNames, overridden, false, lineDelimiter);
245     }
246         
247     /**
248      * Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).
249      * <code>null</code> is returned if the template is empty.
250      * <p>The returned string is unformatted and not indented.
251      *
252      * @param method The method to be documented. The method must exist.
253      * @param overridden The method that will be overridden by the created method or
254      * <code>null</code> for non-overriding methods. If not <code>null</code>, the method must exist.
255      * @param lineDelimiter The line delimiter to be used.
256      * @return Returns the constructed comment or <code>null</code> if
257      * the comment code template is empty. The returned string is unformatted and and has no indent (formatting required).
258      * @throws CoreException Thrown when the evaluation of the code template fails.
259      */

260     public static String JavaDoc getMethodComment(IMethod method, IMethod overridden, String JavaDoc lineDelimiter) throws CoreException {
261         String JavaDoc retType= method.isConstructor() ? null : method.getReturnType();
262         String JavaDoc[] paramNames= method.getParameterNames();
263         String JavaDoc[] typeParameterNames= StubUtility.getTypeParameterNames(method.getTypeParameters());
264         
265         return StubUtility.getMethodComment(method.getCompilationUnit(), method.getDeclaringType().getElementName(),
266             method.getElementName(), paramNames, method.getExceptionTypes(), retType, typeParameterNames, overridden, false, lineDelimiter);
267     }
268     
269     /**
270      * Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).
271      * <code>null</code> is returned if the template is empty.
272      * <p>The returned string is unformatted and not indented.
273      *
274      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
275      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
276      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
277
278      * @param decl The MethodDeclaration AST node that will be added as new
279      * method. The node does not need to exist in an AST (no parent needed) and does not need to resolve.
280      * See {@link org.eclipse.jdt.core.dom.AST#newMethodDeclaration()} for how to create such a node.
281      * @param isDeprecated If set, the method is deprecated
282      * @param overriddenMethodName If a method is overridden, the simple name of the overridden method, or <code>null</code> if no method is overridden.
283      * @param overriddenMethodDeclaringTypeName If a method is overridden, the fully qualified type name of the overridden method's declaring type,
284      * or <code>null</code> if no method is overridden.
285      * @param overriddenMethodParameterTypeNames If a method is overridden, the fully qualified parameter type names of the overridden method,
286      * or <code>null</code> if no method is overridden.
287      * @param lineDelimiter The line delimiter to be used.
288      * @return Returns the constructed comment or <code>null</code> if
289      * the comment code template is empty. The returned string is unformatted and and has no indent (formatting required).
290      * @throws CoreException Thrown when the evaluation of the code template fails.
291      * @since 3.2
292      */

293
294     public static String JavaDoc getMethodComment(ICompilationUnit cu, String JavaDoc declaringTypeName, MethodDeclaration decl, boolean isDeprecated, String JavaDoc overriddenMethodName, String JavaDoc overriddenMethodDeclaringTypeName, String JavaDoc[] overriddenMethodParameterTypeNames, String JavaDoc lineDelimiter) throws CoreException {
295         return StubUtility.getMethodComment(cu, declaringTypeName, decl, isDeprecated, overriddenMethodName, overriddenMethodDeclaringTypeName, overriddenMethodParameterTypeNames, false, lineDelimiter);
296     }
297
298     /**
299      * Returns the content of the body for a method or constructor using the method body templates.
300      * <code>null</code> is returned if the template is empty.
301      * <p>The returned string is unformatted and not indented.
302      *
303      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
304      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
305      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
306      * @param methodName Name of the method.
307      * @param isConstructor Defines if the created body is for a constructor.
308      * @param bodyStatement The code to be entered at the place of the variable ${body_statement}.
309      * @param lineDelimiter The line delimiter to be used.
310      * @return Returns the constructed body content or <code>null</code> if
311      * the comment code template is empty. The returned string is unformatted and and has no indent (formatting required).
312      * @throws CoreException Thrown when the evaluation of the code template fails.
313      */

314     public static String JavaDoc getMethodBodyContent(ICompilationUnit cu, String JavaDoc declaringTypeName, String JavaDoc methodName, boolean isConstructor, String JavaDoc bodyStatement, String JavaDoc lineDelimiter) throws CoreException {
315         return StubUtility.getMethodBodyContent(isConstructor, cu.getJavaProject(), declaringTypeName, methodName, bodyStatement, lineDelimiter);
316     }
317     
318     /**
319      * Returns the content of body for a getter method using the getter method body template.
320      * <code>null</code> is returned if the template is empty.
321      * <p>The returned string is unformatted and not indented.
322      *
323      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
324      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
325      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
326      * @param methodName The name of the getter method.
327      * @param fieldName The name of the field to get in the getter method, corresponding to the template variable for ${field}.
328      * @param lineDelimiter The line delimiter to be used.
329      * @return Returns the constructed body content or <code>null</code> if
330      * the comment code template is empty. The returned string is unformatted and and has no indent (formatting required).
331      * @throws CoreException Thrown when the evaluation of the code template fails.
332      * @since 3.0
333      */

334     public static String JavaDoc getGetterMethodBodyContent(ICompilationUnit cu, String JavaDoc declaringTypeName, String JavaDoc methodName, String JavaDoc fieldName, String JavaDoc lineDelimiter) throws CoreException {
335         return StubUtility.getGetterMethodBodyContent(cu.getJavaProject(), declaringTypeName, methodName, fieldName, lineDelimiter);
336     }
337     
338     /**
339      * Returns the content of body for a setter method using the setter method body template.
340      * <code>null</code> is returned if the template is empty.
341      * <p>The returned string is unformatted and not indented.
342      *
343      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
344      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
345      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
346      * @param methodName The name of the setter method.
347      * @param fieldName The name of the field to be set in the setter method, corresponding to the template variable for ${field}.
348      * @param paramName The name of the parameter passed to the setter method, corresponding to the template variable for $(param).
349      * @param lineDelimiter The line delimiter to be used.
350      * @return Returns the constructed body content or <code>null</code> if
351      * the comment code template is empty. The returned string is unformatted and and has no indent (formatting required).
352      * @throws CoreException Thrown when the evaluation of the code template fails.
353      * @since 3.0
354      */

355     public static String JavaDoc getSetterMethodBodyContent(ICompilationUnit cu, String JavaDoc declaringTypeName, String JavaDoc methodName, String JavaDoc fieldName, String JavaDoc paramName, String JavaDoc lineDelimiter) throws CoreException {
356         return StubUtility.getSetterMethodBodyContent(cu.getJavaProject(), declaringTypeName, methodName, fieldName, paramName, lineDelimiter);
357     }
358     
359     /**
360      * Returns the comment for a getter method using the getter comment template.
361      * <code>null</code> is returned if the template is empty.
362      * <p>The returned string is unformatted and not indented.
363      *
364      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
365      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
366      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
367      * @param methodName Name of the method.
368      * @param fieldName Name of the field to get.
369      * @param fieldType The type of the field to get.
370      * @param bareFieldName The field name without prefix or suffix.
371      * @param lineDelimiter The line delimiter to be used.
372      * @return Returns the generated getter comment or <code>null</code> if the
373      * code template is empty. The returned content is not indented.
374      * @throws CoreException Thrown when the evaluation of the code template fails.
375      * @since 3.0
376      */

377     public static String JavaDoc getGetterComment(ICompilationUnit cu, String JavaDoc declaringTypeName, String JavaDoc methodName, String JavaDoc fieldName, String JavaDoc fieldType, String JavaDoc bareFieldName, String JavaDoc lineDelimiter) throws CoreException {
378         return StubUtility.getGetterComment(cu, declaringTypeName, methodName, fieldName, fieldType, bareFieldName, lineDelimiter);
379     }
380     
381     /**
382      * Returns the comment for a setter method using the setter method body template.
383      * <code>null</code> is returned if the template is empty.
384      * <p>The returned string is unformatted and not indented.
385      *
386      * @param cu The compilation unit to which the method belongs. The compilation unit does not need to exist.
387      * @param declaringTypeName Name of the type to which the method belongs. For inner types the name must be qualified and include the outer
388      * types names (dot separated). See {@link org.eclipse.jdt.core.IType#getTypeQualifiedName(char)}.
389      * @param methodName Name of the method.
390      * @param fieldName Name of the field that is set.
391      * @param fieldType The type of the field that is to set.
392      * @param paramName The name of the parameter that used to set.
393      * @param bareFieldName The field name without prefix or suffix.
394      * @param lineDelimiter The line delimiter to be used.
395      * @return Returns the generated setter comment or <code>null</code> if the
396      * code template is empty. The returned comment is not indented.
397      * @throws CoreException Thrown when the evaluation of the code template fails.
398      * @since 3.0
399      */

400     public static String JavaDoc getSetterComment(ICompilationUnit cu, String JavaDoc declaringTypeName, String JavaDoc methodName, String JavaDoc fieldName, String JavaDoc fieldType, String JavaDoc paramName, String JavaDoc bareFieldName, String JavaDoc lineDelimiter) throws CoreException {
401         return StubUtility.getSetterComment(cu, declaringTypeName, methodName, fieldName, fieldType, paramName, bareFieldName, lineDelimiter);
402     }
403 }
404
Popular Tags