Class CodeGeneration
This class is not intended to be subclassed or instantiated by clients.
- Since:
- 1.11
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new annotation type body.static final String
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new class type body.static final String
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new enum type body.static final String
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new interface type body.static final String
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new record type body. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getCompilationUnitContent
(ICompilationUnit cu, String typeComment, String typeContent, String lineDelimiter) Returns the content for a new compilation unit using the 'new Java file' code template.static String
getCompilationUnitContent
(ICompilationUnit cu, String fileComment, String typeComment, String typeContent, String lineDelimiter) Returns the content for a new compilation unit using the 'new Java file' code template.static String
getFieldComment
(ICompilationUnit cu, String typeName, String fieldName, String lineDelimiter) Returns the content for a new field comment using the 'field comment' code template.static String
getFileComment
(ICompilationUnit cu, String lineDelimiter) Returns the content for a new file comment using the 'file comment' code template.static String
getGetterComment
(ICompilationUnit cu, String declaringTypeName, String methodName, String fieldName, String fieldType, String bareFieldName, String lineDelimiter) Returns the comment for a getter method using the getter comment template.static String
getGetterMethodBodyContent
(ICompilationUnit cu, String declaringTypeName, String methodName, String fieldName, String lineDelimiter) Returns the content of body for a getter method using the getter method body template.static String
getMethodBodyContent
(ICompilationUnit cu, String declaringTypeName, String methodName, boolean isConstructor, boolean useAlternativeMethodBody, String bodyStatement, String lineDelimiter) Returns the content of the body for a method or constructor using the method body templates.static String
getMethodBodyContent
(ICompilationUnit cu, String declaringTypeName, String methodName, boolean isConstructor, String bodyStatement, String lineDelimiter) Returns the content of the body for a method or constructor using the method body templates.static String
getMethodComment
(ICompilationUnit cu, String declaringTypeName, String methodName, String[] paramNames, String[] excTypeSig, String retTypeSig, String[] typeParameterNames, IMethod overridden, String lineDelimiter) Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).static String
getMethodComment
(ICompilationUnit cu, String declaringTypeName, String methodName, String[] paramNames, String[] excTypeSig, String retTypeSig, IMethod overridden, String lineDelimiter) Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).static String
getMethodComment
(ICompilationUnit cu, String declaringTypeName, MethodDeclaration decl, boolean isDeprecated, String overriddenMethodName, String overriddenMethodDeclaringTypeName, String[] overriddenMethodParameterTypeNames, String lineDelimiter) Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).static String
getMethodComment
(ICompilationUnit cu, String declaringTypeName, MethodDeclaration decl, IMethodBinding overridden, String lineDelimiter) Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).static String
getMethodComment
(IMethod method, IMethod overridden, String lineDelimiter) Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).static String
getModuleComment
(ICompilationUnit cu, String moduleName, String[] providesNames, String[] usesNames, String lineDelimiter) Returns the comment for a module based on code templatesstatic String
getModuleComment
(ICompilationUnit cu, IModuleDescription desc, String lineDelimiter) Returns the comment for a module based on code templatesstatic String
getSetterComment
(ICompilationUnit cu, String declaringTypeName, String methodName, String fieldName, String fieldType, String paramName, String bareFieldName, String lineDelimiter) Returns the comment for a setter method using the setter method body template.static String
getSetterMethodBodyContent
(ICompilationUnit cu, String declaringTypeName, String methodName, String fieldName, String paramName, String lineDelimiter) Returns the content of body for a setter method using the setter method body template.static String
getTypeBody
(String typeKind, ICompilationUnit cu, String typeName, String lineDelim) Returns the content of a new new type body using the 'type body' code templates.static String
getTypeComment
(ICompilationUnit cu, String typeQualifiedName, String lineDelimiter) Returns the content for a new type comment using the 'type comment' code template.static String
getTypeComment
(ICompilationUnit cu, String typeQualifiedName, String[] typeParameterNames, String lineDelimiter) Returns the content for a new type comment using the 'type comment' code template.static String
getTypeComment
(ICompilationUnit cu, String typeQualifiedName, String[] typeParameterNames, String[] params, String lineDelimiter) Returns the content for a new type comment using the 'type comment' code template.
-
Field Details
-
CLASS_BODY_TEMPLATE_ID
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new class type body.- Since:
- 3.2
- See Also:
-
INTERFACE_BODY_TEMPLATE_ID
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new interface type body.- Since:
- 3.2
- See Also:
-
ENUM_BODY_TEMPLATE_ID
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new enum type body.- Since:
- 3.2
- See Also:
-
ANNOTATION_BODY_TEMPLATE_ID
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new annotation type body.- Since:
- 3.2
- See Also:
-
RECORD_BODY_TEMPLATE_ID
Constant ID for the type kind to be used ingetTypeBody(String, ICompilationUnit, String, String)
to get the code template used for a new record type body.- Since:
- 1.14
- See Also:
- Restriction:
- This field is not intended to be referenced by clients.
-
-
Method Details
-
getCompilationUnitContent
public static String getCompilationUnitContent(ICompilationUnit cu, String typeComment, String typeContent, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content for a new compilation unit using the 'new Java file' code template.- Parameters:
cu
- The compilation unit to create the source for. The compilation unit does not need to exist.typeComment
- The comment for the type to be created. Used when the code template contains a ${typecomment} variable. Can benull
if no comment should be added.typeContent
- The code of the type, including type declaration and body.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the new content or
null
if the template is undefined or empty. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.
-
getCompilationUnitContent
public static String getCompilationUnitContent(ICompilationUnit cu, String fileComment, String typeComment, String typeContent, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content for a new compilation unit using the 'new Java file' code template.- Parameters:
cu
- The compilation unit to create the source for. The compilation unit does not need to exist.fileComment
- The file comment to be used when the code template contains a ${filecomment} variable. Can benull
if no comment should be added.typeComment
- The comment for the type to be created. Used when the code template contains a ${typecomment} variable. Can benull
if no comment should be added.typeContent
- The code of the type, including type declaration and body.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the new content or
null
if the template is undefined or empty. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.1
-
getFileComment
public static String getFileComment(ICompilationUnit cu, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content for a new file comment using the 'file comment' code template. The returned content is unformatted and is not indented.- Parameters:
cu
- The compilation unit to add the comment to. The compilation unit does not need to exist.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the new content or
null
if the code template is undefined or empty. The returned content is unformatted and is not indented. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.1
-
getTypeComment
public static String getTypeComment(ICompilationUnit cu, String typeQualifiedName, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content for a new type comment using the 'type comment' code template. The returned content is unformatted and is not indented.- Parameters:
cu
- The compilation unit where the type is contained. The compilation unit does not need to exist.typeQualifiedName
- The name of the type to which the comment is added. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the new content or
null
if the code template is undefined or empty. The returned content is unformatted and is not indented. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.
-
getTypeComment
public static String getTypeComment(ICompilationUnit cu, String typeQualifiedName, String[] typeParameterNames, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content for a new type comment using the 'type comment' code template. The returned content is unformatted and is not indented.- Parameters:
cu
- The compilation unit where the type is contained. The compilation unit does not need to exist.typeQualifiedName
- The name of the type to which the comment is added. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.typeParameterNames
- The type parameter nameslineDelimiter
- The line delimiter to be used.- Returns:
- Returns the new content or
null
if the code template is undefined or empty. The returned content is unformatted and is not indented. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.1
-
getTypeComment
public static String getTypeComment(ICompilationUnit cu, String typeQualifiedName, String[] typeParameterNames, String[] params, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content for a new type comment using the 'type comment' code template. The returned content is unformatted and is not indented.- Parameters:
cu
- The compilation unit where the type is contained. The compilation unit does not need to exist.typeQualifiedName
- The name of the type to which the comment is added. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.typeParameterNames
- The type parameter namesparams
- The parameter names - currently useful only for recordslineDelimiter
- The line delimiter to be used.- Returns:
- Returns the new content or
null
if the code template is undefined or empty. The returned content is unformatted and is not indented. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 1.14
-
getTypeBody
public static String getTypeBody(String typeKind, ICompilationUnit cu, String typeName, String lineDelim) throws org.eclipse.core.runtime.CoreException Returns the content of a new new type body using the 'type body' code templates. The returned content is unformatted and is not indented.- Parameters:
typeKind
- The type kind ID of the body template. Valid values areCLASS_BODY_TEMPLATE_ID
,INTERFACE_BODY_TEMPLATE_ID
,ENUM_BODY_TEMPLATE_ID
andANNOTATION_BODY_TEMPLATE_ID
.cu
- The compilation unit where the type is contained. The compilation unit does not need to exist.typeName
- The name of the type(for embedding in the template as a user variable).lineDelim
- The line delimiter to be used.- Returns:
- Returns the new content or
null
if the code template is undefined or empty. The returned content is unformatted and is not indented. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.2
-
getFieldComment
public static String getFieldComment(ICompilationUnit cu, String typeName, String fieldName, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content for a new field comment using the 'field comment' code template. The returned content is unformatted and is not indented.- Parameters:
cu
- The compilation unit where the field is contained. The compilation unit does not need to exist.typeName
- The name of the field declared type.fieldName
- The name of the field to which the comment is added.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the new content or
null
if the code template is undefined or empty. The returned content is unformatted and is not indented. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.0
-
getMethodComment
public static String getMethodComment(ICompilationUnit cu, String declaringTypeName, MethodDeclaration decl, IMethodBinding overridden, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).null
is returned if the template is empty.- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.decl
- The MethodDeclaration AST node that will be added as new method. The node does not need to exist in an AST (no parent needed) and does not need to resolve. SeeAST.newMethodDeclaration()
for how to create such a node.overridden
- The binding of the method to which to add an "@see" link ornull
if no link should be created.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the generated method comment or
null
if the code template is empty. The returned content is unformatted and not indented (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.
-
getMethodComment
public static String getMethodComment(ICompilationUnit cu, String declaringTypeName, String methodName, String[] paramNames, String[] excTypeSig, String retTypeSig, IMethod overridden, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).null
is returned if the template is empty.The returned string is unformatted and not indented.
Exception types and return type are in signature notation. e.g. a source method declared as
public void foo(String text, int length)
would return the array{"QString;","I"}
as parameter types. SeeSignature
.- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.methodName
- Name of the method.paramNames
- Names of the parameters for the method.excTypeSig
- Thrown exceptions (Signature notation).retTypeSig
- Return type (Signature notation) ornull
for constructors.overridden
- The method that will be overridden by the created method ornull
for non-overriding methods. If notnull
, the method must exist.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the constructed comment or
null
if the comment code template is empty. The returned content is unformatted and not indented (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.
-
getMethodComment
public static String getMethodComment(ICompilationUnit cu, String declaringTypeName, String methodName, String[] paramNames, String[] excTypeSig, String retTypeSig, String[] typeParameterNames, IMethod overridden, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).null
is returned if the template is empty.The returned string is unformatted and not indented.
Exception types and return type are in signature notation. e.g. a source method declared as
public void foo(String text, int length)
would return the array{"QString;","I"}
as parameter types. SeeSignature
.- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.methodName
- Name of the method.paramNames
- Names of the parameters for the method.excTypeSig
- Thrown exceptions (Signature notation).retTypeSig
- Return type (Signature notation) ornull
for constructors.typeParameterNames
- Names of the type parameters for the method.overridden
- The method that will be overridden by the created method ornull
for non-overriding methods. If notnull
, the method must exist.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the constructed comment or
null
if the comment code template is empty. The returned content is unformatted and not indented (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.1
-
getMethodComment
public static String getMethodComment(IMethod method, IMethod overridden, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).null
is returned if the template is empty.The returned string is unformatted and not indented.
- Parameters:
method
- The method to be documented. The method must exist.overridden
- The method that will be overridden by the created method ornull
for non-overriding methods. If notnull
, the method must exist.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the constructed comment or
null
if the comment code template is empty. The returned string is unformatted and and has no indent (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.
-
getMethodComment
public static String getMethodComment(ICompilationUnit cu, String declaringTypeName, MethodDeclaration decl, boolean isDeprecated, String overriddenMethodName, String overriddenMethodDeclaringTypeName, String[] overriddenMethodParameterTypeNames, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).null
is returned if the template is empty.The returned string is unformatted and not indented.
- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.decl
- The MethodDeclaration AST node that will be added as new method. The node does not need to exist in an AST (no parent needed) and does not need to resolve. SeeAST.newMethodDeclaration()
for how to create such a node.isDeprecated
- If set, the method is deprecatedoverriddenMethodName
- If a method is overridden, the simple name of the overridden method, ornull
if no method is overridden.overriddenMethodDeclaringTypeName
- If a method is overridden, the fully qualified type name of the overridden method's declaring type, ornull
if no method is overridden.overriddenMethodParameterTypeNames
- If a method is overridden, the fully qualified parameter type names of the overridden method, ornull
if no method is overridden.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the constructed comment or
null
if the comment code template is empty. The returned string is unformatted and and has no indent (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.2
-
getModuleComment
public static String getModuleComment(ICompilationUnit cu, String moduleName, String[] providesNames, String[] usesNames, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a module based on code templates- Parameters:
cu
- The compilation unit for the modulemoduleName
- The name of the moduleprovidesNames
- Names of provided servicesusesNames
- Names of used moduleslineDelimiter
- The line delimiter to use- Returns:
- Module comment
- Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails- Since:
- 1.12
-
getModuleComment
public static String getModuleComment(ICompilationUnit cu, IModuleDescription desc, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a module based on code templates- Parameters:
cu
- The compilation unit for the moduledesc
- The module descriptionlineDelimiter
- The line delimiter to use- Returns:
- Module comment
- Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails- Since:
- 1.12
-
getMethodBodyContent
public static String getMethodBodyContent(ICompilationUnit cu, String declaringTypeName, String methodName, boolean isConstructor, String bodyStatement, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content of the body for a method or constructor using the method body templates.null
is returned if the template is empty.The returned string is unformatted and not indented.
- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.methodName
- Name of the method.isConstructor
- Defines if the created body is for a constructor.bodyStatement
- The code to be entered at the place of the variable ${body_statement}.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the constructed body content or
null
if the comment code template is empty. The returned string is unformatted and and has no indent (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.
-
getMethodBodyContent
public static String getMethodBodyContent(ICompilationUnit cu, String declaringTypeName, String methodName, boolean isConstructor, boolean useAlternativeMethodBody, String bodyStatement, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content of the body for a method or constructor using the method body templates.null
is returned if the template is empty.The returned string is unformatted and not indented.
- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.methodName
- Name of the method.isConstructor
- Defines if the created body is for a constructor.useAlternativeMethodBody
- Defines if the alternative method body template is to be used.bodyStatement
- The code to be entered at the place of the variable ${body_statement}.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the constructed body content or
null
if the comment code template is empty. The returned string is unformatted and and has no indent (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 1.18
-
getGetterMethodBodyContent
public static String getGetterMethodBodyContent(ICompilationUnit cu, String declaringTypeName, String methodName, String fieldName, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content of body for a getter method using the getter method body template.null
is returned if the template is empty.The returned string is unformatted and not indented.
- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.methodName
- The name of the getter method.fieldName
- The name of the field to get in the getter method, corresponding to the template variable for ${field}.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the constructed body content or
null
if the comment code template is empty. The returned string is unformatted and and has no indent (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.0
-
getSetterMethodBodyContent
public static String getSetterMethodBodyContent(ICompilationUnit cu, String declaringTypeName, String methodName, String fieldName, String paramName, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the content of body for a setter method using the setter method body template.null
is returned if the template is empty.The returned string is unformatted and not indented.
- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.methodName
- The name of the setter method.fieldName
- The name of the field to be set in the setter method, corresponding to the template variable for ${field}.paramName
- The name of the parameter passed to the setter method, corresponding to the template variable for $(param).lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the constructed body content or
null
if the comment code template is empty. The returned string is unformatted and and has no indent (formatting required). - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.0
-
getGetterComment
public static String getGetterComment(ICompilationUnit cu, String declaringTypeName, String methodName, String fieldName, String fieldType, String bareFieldName, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a getter method using the getter comment template.null
is returned if the template is empty.The returned string is unformatted and not indented.
- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.methodName
- Name of the method.fieldName
- Name of the field to get.fieldType
- The type of the field to get.bareFieldName
- The field name without prefix or suffix.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the generated getter comment or
null
if the code template is empty. The returned content is not indented. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.0
-
getSetterComment
public static String getSetterComment(ICompilationUnit cu, String declaringTypeName, String methodName, String fieldName, String fieldType, String paramName, String bareFieldName, String lineDelimiter) throws org.eclipse.core.runtime.CoreException Returns the comment for a setter method using the setter method body template.null
is returned if the template is empty.The returned string is unformatted and not indented.
- Parameters:
cu
- The compilation unit to which the method belongs. The compilation unit does not need to exist.declaringTypeName
- Name of the type to which the method belongs. For inner types the name must be qualified and include the outer types names (dot separated). SeeIType.getTypeQualifiedName(char)
.methodName
- Name of the method.fieldName
- Name of the field that is set.fieldType
- The type of the field that is to set.paramName
- The name of the parameter that used to set.bareFieldName
- The field name without prefix or suffix.lineDelimiter
- The line delimiter to be used.- Returns:
- Returns the generated setter comment or
null
if the code template is empty. The returned comment is not indented. - Throws:
org.eclipse.core.runtime.CoreException
- Thrown when the evaluation of the code template fails.- Since:
- 3.0
-