Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse JDT
Release 3.5

org.eclipse.jdt.core
Class NamingConventions


java.lang.Object
  extended by 
org.eclipse.jdt.core.NamingConventions

public final class NamingConventions
extends Object

Provides methods for computing Java-specific names.

The behavior of the methods is dependent of several JavaCore options.

The possible options are :

For a complete description of the configurable options, see JavaCore.getDefaultOptions(). To programmatically change these options, see JavaCore.setOptions(java.util.Hashtable).

This class provides static methods and constants only.

Since:
2.1
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()
Restriction:
This class is not intended to be instantiated by clients.

Field Summary
static int BK_NAME
          The base name associated to this base name kind is a simple name.
static int BK_TYPE_NAME
          The base name associated to this base name kind is a simple type name.
static int VK_INSTANCE_FIELD
          Variable kind which represents an instance field.
static int VK_LOCAL
          Variable kind which represents a local variable.
static int VK_PARAMETER
          Variable kind which represents an argument.
static int VK_STATIC_FIELD
          Variable kind which represents a static field.
static int VK_STATIC_FINAL_FIELD
          Variable kind which represents a static final field.
 
Method Summary
static  String getBaseName (int variableKind, String variableName, IJavaProject javaProject)
          Returns a base name which could be used to generate the given variable name with suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean).
static char[] removePrefixAndSuffixForArgumentName ( IJavaProject javaProject, char[] argumentName)
          Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_PARAMETER as variable kind.
static  String removePrefixAndSuffixForArgumentName ( IJavaProject javaProject, String argumentName)
          Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_PARAMETER as variable kind.
static char[] removePrefixAndSuffixForFieldName ( IJavaProject javaProject, char[] fieldName, int modifiers)
          Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_INSTANCE_FIELD or VK_STATIC_FIELD as variable kind.
static  String removePrefixAndSuffixForFieldName ( IJavaProject javaProject, String fieldName, int modifiers)
          Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_INSTANCE_FIELD or VK_STATIC_FIELD as variable kind.
static char[] removePrefixAndSuffixForLocalVariableName ( IJavaProject javaProject, char[] localName)
          Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_LOCAL as variable kind.
static  String removePrefixAndSuffixForLocalVariableName ( IJavaProject javaProject, String localName)
          Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_LOCAL as variable kind.
static char[][] suggestArgumentNames ( IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[][] excludedNames)
          Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_PARAMETER as variable kind.
static  String[] suggestArgumentNames ( IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, String[] excludedNames)
          Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_PARAMETER as variable kind.
static char[][] suggestFieldNames ( IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, int modifiers, char[][] excludedNames)
          Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_INSTANCE_FIELD or VK_STATIC_FIELD as variable kind.
static  String[] suggestFieldNames ( IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, int modifiers, String[] excludedNames)
          Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_INSTANCE_FIELD or VK_STATIC_FIELD as variable kind.
static char[] suggestGetterName ( IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames)
          Suggest name for a getter method.
static  String suggestGetterName ( IJavaProject project, String fieldName, int modifiers, boolean isBoolean, String[] excludedNames)
          Suggest name for a getter method.
static char[][] suggestLocalVariableNames ( IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[][] excludedNames)
          Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_LOCAL as variable kind.
static  String[] suggestLocalVariableNames ( IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, String[] excludedNames)
          Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_LOCAL as variable kind.
static char[] suggestSetterName ( IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames)
          Suggest name for a setter method.
static  String suggestSetterName ( IJavaProject project, String fieldName, int modifiers, boolean isBoolean, String[] excludedNames)
          Suggest name for a setter method.
static  String[] suggestVariableNames (int variableKind, int baseNameKind, String baseName, IJavaProject javaProject, int dim, String[] excluded, boolean evaluateDefault)
          Suggests names for a variable.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VK_STATIC_FIELD

public static final int VK_STATIC_FIELD
Variable kind which represents a static field.

Since:
3.5
See Also:
Constant Field Values

VK_INSTANCE_FIELD

public static final int VK_INSTANCE_FIELD
Variable kind which represents an instance field.

Since:
3.5
See Also:
Constant Field Values

VK_STATIC_FINAL_FIELD

public static final int VK_STATIC_FINAL_FIELD
Variable kind which represents a static final field.

Since:
3.5
See Also:
Constant Field Values

VK_PARAMETER

public static final int VK_PARAMETER
Variable kind which represents an argument.

Since:
3.5
See Also:
Constant Field Values

VK_LOCAL

public static final int VK_LOCAL
Variable kind which represents a local variable.

Since:
3.5
See Also:
Constant Field Values

BK_NAME

public static final int BK_NAME
The base name associated to this base name kind is a simple name. When this base name is used the whole name is considered.

Since:
3.5
See Also:
suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean), Constant Field Values

BK_TYPE_NAME

public static final int BK_TYPE_NAME
The base name associated to this base name kind is a simple type name. When this base name is used all the words of the name are considered.

Since:
3.5
See Also:
suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean), Constant Field Values
Method Detail

removePrefixAndSuffixForArgumentName

public static char[] removePrefixAndSuffixForArgumentName(
IJavaProject javaProject,
                                                          char[] argumentName)
Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_PARAMETER as variable kind.

Remove prefix and suffix from an argument name.

If argument name prefix is pre and argument name suffix is suf then for an argument named preArgsuf the result of this method is arg. If there is no prefix or suffix defined in JavaCore options the result is the unchanged name preArgsuf.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_ARGUMENT_PREFIXES and JavaCore.CODEASSIST_ARGUMENT_SUFFIXES.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the argument.
argumentName - argument's name.
Returns:
char[] the name without prefix and suffix.
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

removePrefixAndSuffixForArgumentName

public static 
String removePrefixAndSuffixForArgumentName(
IJavaProject javaProject,
                                                          
String argumentName)
Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_PARAMETER as variable kind.

Remove prefix and suffix from an argument name.

If argument name prefix is pre and argument name suffix is suf then for an argument named preArgsuf the result of this method is arg. If there is no prefix or suffix defined in JavaCore options the result is the unchanged name preArgsuf.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_ARGUMENT_PREFIXES and JavaCore.CODEASSIST_ARGUMENT_SUFFIXES.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the argument.
argumentName - argument's name.
Returns:
char[] the name without prefix and suffix.
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

removePrefixAndSuffixForFieldName

public static char[] removePrefixAndSuffixForFieldName(
IJavaProject javaProject,
                                                       char[] fieldName,
                                                       int modifiers)
Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_INSTANCE_FIELD or VK_STATIC_FIELD as variable kind.

Remove prefix and suffix from a field name.

If field name prefix is pre and field name suffix is suf then for a field named preFieldsuf the result of this method is field. If there is no prefix or suffix defined in JavaCore options the result is the unchanged name preFieldsuf.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_FIELD_PREFIXES } , JavaCore.CODEASSIST_FIELD_SUFFIXES for instance field and JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES for static field.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the field.
fieldName - field's name.
modifiers - field's modifiers as defined by the class Flags.
Returns:
char[] the name without prefix and suffix.
See Also:
Flags, JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

removePrefixAndSuffixForFieldName

public static 
String removePrefixAndSuffixForFieldName(
IJavaProject javaProject,
                                                       
String fieldName,
                                                       int modifiers)
Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_INSTANCE_FIELD or VK_STATIC_FIELD as variable kind.

Remove prefix and suffix from a field name.

If field name prefix is pre and field name suffix is suf then for a field named preFieldsuf the result of this method is field. If there is no prefix or suffix defined in JavaCore options the result is the unchanged name preFieldsuf.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_FIELD_PREFIXES, JavaCore.CODEASSIST_FIELD_SUFFIXES for instance field and JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES for static field.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the field.
fieldName - field's name.
modifiers - field's modifiers as defined by the class Flags.
Returns:
char[] the name without prefix and suffix.
See Also:
Flags, JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

removePrefixAndSuffixForLocalVariableName

public static char[] removePrefixAndSuffixForLocalVariableName(
IJavaProject javaProject,
                                                               char[] localName)
Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_LOCAL as variable kind.

Remove prefix and suffix from a local variable name.

If local variable name prefix is pre and local variable name suffix is suf then for a local variable named preLocalsuf the result of this method is local. If there is no prefix or suffix defined in JavaCore options the result is the unchanged name preLocalsuf.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_LOCAL_PREFIXES and JavaCore.CODEASSIST_LOCAL_SUFFIXES.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the variable.
localName - variable's name.
Returns:
char[] the name without prefix and suffix.
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

removePrefixAndSuffixForLocalVariableName

public static 
String removePrefixAndSuffixForLocalVariableName(
IJavaProject javaProject,
                                                               
String localName)
Deprecated. Use getBaseName(int, String, IJavaProject) instead with VK_LOCAL as variable kind.

Remove prefix and suffix from a local variable name.

If local variable name prefix is pre and local variable name suffix is suf then for a local variable named preLocalsuf the result of this method is local. If there is no prefix or suffix defined in JavaCore options the result is the unchanged name preLocalsuf.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_LOCAL_PREFIXES and JavaCore.CODEASSIST_LOCAL_SUFFIXES.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the variable.
localName - variable's name.
Returns:
char[] the name without prefix and suffix.
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

getBaseName

public static 
String getBaseName(int variableKind,
                                 
String variableName,
                                 
IJavaProject javaProject)
Returns a base name which could be used to generate the given variable name with suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean).

e.g.
If the variable is a VK_LOCAL and the variable name is variableName then the base name will be variableName.
If the variable is a VK_STATIC_FINAL_FIELD and the variable name is VARIABLE_NAME then the base name will be variableName.

Prefixes and suffixes defined in JavaCore options will be also removed from the variable name.
Each variable kind is affected by the following JavaCore options:

e.g.
If the variable is a VK_LOCAL, the variable name is preVariableNamesuf, a possible prefix is pre and a possible suffix is suf then the base name will be variableName.

Parameters:
variableKind - specifies what type the variable is: VK_LOCAL, VK_PARAMETER, VK_STATIC_FIELD, VK_INSTANCE_FIELD or VK_STATIC_FINAL_FIELD.
variableName - a variable name
javaProject - project which contains the variable or null to take into account only workspace settings.
Since:
3.5
See Also:
suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean)

suggestArgumentNames

public static char[][] suggestArgumentNames(
IJavaProject javaProject,
                                            char[] packageName,
                                            char[] qualifiedTypeName,
                                            int dim,
                                            char[][] excludedNames)
Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_PARAMETER as variable kind.

Suggest names for an argument. The name is computed from argument's type and possible prefixes or suffixes are added.

If the type of the argument is TypeName, the prefix for argument is pre and the suffix for argument is suf then the proposed names are preTypeNamesuf and preNamesuf. If there is no prefix or suffix the proposals are typeName and name.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_ARGUMENT_PREFIXES and JavaCore.CODEASSIST_ARGUMENT_SUFFIXES.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the argument.
packageName - package of the argument's type.
qualifiedTypeName - argument's type.
dim - argument's dimension (0 if the argument is not an array).
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[][] an array of names.
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestArgumentNames

public static 
String[] suggestArgumentNames(
IJavaProject javaProject,
                                            
String packageName,
                                            
String qualifiedTypeName,
                                            int dim,
                                            
String[] excludedNames)
Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_PARAMETER as variable kind.

Suggest names for an argument. The name is computed from argument's type and possible prefixes or suffixes are added.

If the type of the argument is TypeName, the prefix for argument is pre and the suffix for argument is suf then the proposed names are preTypeNamesuf and preNamesuf. If there is no prefix or suffix the proposals are typeName and name.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_ARGUMENT_PREFIXES and JavaCore.CODEASSIST_ARGUMENT_SUFFIXES.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the argument.
packageName - package of the argument's type.
qualifiedTypeName - argument's type.
dim - argument's dimension (0 if the argument is not an array).
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[][] an array of names.
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestFieldNames

public static char[][] suggestFieldNames(
IJavaProject javaProject,
                                         char[] packageName,
                                         char[] qualifiedTypeName,
                                         int dim,
                                         int modifiers,
                                         char[][] excludedNames)
Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_INSTANCE_FIELD or VK_STATIC_FIELD as variable kind.

Suggest names for a field. The name is computed from field's type and possible prefixes or suffixes are added.

If the type of the field is TypeName, the prefix for field is pre and the suffix for field is suf then the proposed names are preTypeNamesuf and preNamesuf. If there is no prefix or suffix the proposals are typeName and name.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_FIELD_PREFIXES, JavaCore.CODEASSIST_FIELD_SUFFIXES and for instance field and JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES for static field.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the field.
packageName - package of the field's type.
qualifiedTypeName - field's type.
dim - field's dimension (0 if the field is not an array).
modifiers - field's modifiers as defined by the class Flags.
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[][] an array of names.
See Also:
Flags, JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestFieldNames

public static 
String[] suggestFieldNames(
IJavaProject javaProject,
                                         
String packageName,
                                         
String qualifiedTypeName,
                                         int dim,
                                         int modifiers,
                                         
String[] excludedNames)
Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_INSTANCE_FIELD or VK_STATIC_FIELD as variable kind.

Suggest names for a field. The name is computed from field's type and possible prefixes or suffixes are added.

If the type of the field is TypeName, the prefix for field is pre and the suffix for field is suf then the proposed names are preTypeNamesuf and preNamesuf. If there is no prefix or suffix the proposals are typeName and name.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_FIELD_PREFIXES, JavaCore.CODEASSIST_FIELD_SUFFIXES and for instance field and JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES for static field.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the field.
packageName - package of the field's type.
qualifiedTypeName - field's type.
dim - field's dimension (0 if the field is not an array).
modifiers - field's modifiers as defined by the class Flags.
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[][] an array of names.
See Also:
Flags, JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestGetterName

public static char[] suggestGetterName(
IJavaProject project,
                                       char[] fieldName,
                                       int modifiers,
                                       boolean isBoolean,
                                       char[][] excludedNames)
Suggest name for a getter method. The name is computed from field's name and possible prefixes or suffixes are removed.

If the field name is preFieldNamesuf and the prefix for field is pre and the suffix for field is suf then the prosposed name is isFieldName for boolean field or getFieldName for others. If there is no prefix and suffix the proposal is isPreFieldNamesuf for boolean field or getPreFieldNamesuf for others.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_FIELD_PREFIXES, JavaCore.CODEASSIST_FIELD_SUFFIXES for instance field and JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES for static field.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
project - project which contains the field.
fieldName - field's name's.
modifiers - field's modifiers as defined by the class Flags.
isBoolean - true if the field's type is boolean
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[] a name.
See Also:
Flags, JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestGetterName

public static 
String suggestGetterName(
IJavaProject project,
                                       
String fieldName,
                                       int modifiers,
                                       boolean isBoolean,
                                       
String[] excludedNames)
Suggest name for a getter method. The name is computed from field's name and possible prefixes or suffixes are removed.

If the field name is preFieldNamesuf and the prefix for field is pre and the suffix for field is suf then the prosposed name is isFieldName for boolean field or getFieldName for others. If there is no prefix and suffix the proposal is isPreFieldNamesuf for boolean field or getPreFieldNamesuf for others.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_FIELD_PREFIXES, JavaCore.CODEASSIST_FIELD_SUFFIXES for instance field and JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES for static field.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
project - project which contains the field.
fieldName - field's name's.
modifiers - field's modifiers as defined by the class Flags.
isBoolean - true if the field's type is boolean
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[] a name.
See Also:
Flags, JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestLocalVariableNames

public static char[][] suggestLocalVariableNames(
IJavaProject javaProject,
                                                 char[] packageName,
                                                 char[] qualifiedTypeName,
                                                 int dim,
                                                 char[][] excludedNames)
Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_LOCAL as variable kind.

Suggest names for a local variable. The name is computed from variable's type and possible prefixes or suffixes are added.

If the type of the local variable is TypeName, the prefix for local variable is pre and the suffix for local variable is suf then the proposed names are preTypeNamesuf and preNamesuf. If there is no prefix or suffix the proposals are typeName and name.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_LOCAL_PREFIXES and JavaCore.CODEASSIST_LOCAL_SUFFIXES.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the variable.
packageName - package of the variable's type.
qualifiedTypeName - variable's type.
dim - variable's dimension (0 if the variable is not an array).
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[][] an array of names.
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestLocalVariableNames

public static 
String[] suggestLocalVariableNames(
IJavaProject javaProject,
                                                 
String packageName,
                                                 
String qualifiedTypeName,
                                                 int dim,
                                                 
String[] excludedNames)
Deprecated. Use suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean) instead with VK_LOCAL as variable kind.

Suggest names for a local variable. The name is computed from variable's type and possible prefixes or suffixes are added.

If the type of the local variable is TypeName, the prefix for local variable is pre and the suffix for local variable is suf then the proposed names are preTypeNamesuf and preNamesuf. If there is no prefix or suffix the proposals are typeName and name.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_LOCAL_PREFIXES and JavaCore.CODEASSIST_LOCAL_SUFFIXES.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
javaProject - project which contains the variable.
packageName - package of the variable's type.
qualifiedTypeName - variable's type.
dim - variable's dimension (0 if the variable is not an array).
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[][] an array of names.
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestSetterName

public static char[] suggestSetterName(
IJavaProject project,
                                       char[] fieldName,
                                       int modifiers,
                                       boolean isBoolean,
                                       char[][] excludedNames)
Suggest name for a setter method. The name is computed from field's name and possible prefixes or suffixes are removed.

If the field name is preFieldNamesuf and the prefix for field is pre and the suffix for field is suf then the proposed name is setFieldName. If there is no prefix and suffix the proposal is setPreFieldNamesuf.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_FIELD_PREFIXES, JavaCore.CODEASSIST_FIELD_SUFFIXES for instance field and JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES for static field.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
project - project which contains the field.
fieldName - field's name's.
modifiers - field's modifiers as defined by the class Flags.
isBoolean - true if the field's type is boolean
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[] a name.
See Also:
Flags, JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestSetterName

public static 
String suggestSetterName(
IJavaProject project,
                                       
String fieldName,
                                       int modifiers,
                                       boolean isBoolean,
                                       
String[] excludedNames)
Suggest name for a setter method. The name is computed from field's name and possible prefixes or suffixes are removed.

If the field name is preFieldNamesuf and the prefix for field is pre and the suffix for field is suf then the proposed name is setFieldName. If there is no prefix and suffix the proposal is setPreFieldNamesuf.

This method is affected by the following JavaCore options : JavaCore.CODEASSIST_FIELD_PREFIXES, JavaCore.CODEASSIST_FIELD_SUFFIXES for instance field and JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES for static field.

For a complete description of these configurable options, see getDefaultOptions. For programmaticaly change these options, see JavaCore#setOptions().

Parameters:
project - project which contains the field.
fieldName - field's name's.
modifiers - field's modifiers as defined by the class Flags.
isBoolean - true if the field's type is boolean
excludedNames - a list of names which cannot be suggested (already used names). Can be null if there is no excluded names.
Returns:
char[] a name.
See Also:
Flags, JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

suggestVariableNames

public static 
String[] suggestVariableNames(int variableKind,
                                            int baseNameKind,
                                            
String baseName,
                                            
IJavaProject javaProject,
                                            int dim,
                                            
String[] excluded,
                                            boolean evaluateDefault)
Suggests names for a variable. The name is computed from a base name and possible prefixes or suffixes are added.

The base name is used to compute the variable name. Some different kinds of base names are possible and each kind is associated to a different heuristic to compute variable names.
The heuristic depends also on the kind of the variable. Each kind of variable is identified by a constant starting with VK_.
When a prefix and a suffix can be added then all combinations of prefix and suffix are suggested. If the name is name, the prefix is pre and the suffix is suf then the suggested names will be prenamesuf, prename, namesuf and name.

The different kinds of base names are:

  • BK_NAME: the base name is a Java name and the whole base name is considered to compute the variable names. A prefix and a suffix can be added.
    There is a heuristic by variable kind.
    • VK_PARAMETER, VK_LOCAL, VK_INSTANCE_FIELD and VK_STATIC_FIELD:
      In this case the first character will be converted to lower case and the other characters won't be changed.
      If the base name is SimpleName then the suggested name will be simpleName.
    • VK_STATIC_FINAL_FIELD :
      In this case all letters of the name will be converted to upper case and words will be separated by an underscore ("_").
      If the base name is SimpleName then the suggested name will be SIMPLE_NAME.
  • BK_TYPE_NAME: the base name is a Java simple type name (e.g. HashMap) and all the words of the base name are considered to compute the variable names. A prefix and a suffix can be added to these names.
    There is a heuristic by variable kind.
    • VK_PARAMETER, VK_LOCAL, VK_INSTANCE_FIELD and VK_STATIC_FIELD:
      In this case a variable name will contain some words of the base name and the first character will be converted to lower case.
      If the type is TypeName then the suggested names will be typeName and name.
    • VK_STATIC_FINAL_FIELD :
      In this case a variable name will contain some words of the base name, all letters of the name will be converted to upper case and segments will be separated by a underscore ("_").
      If the base name is TypeName then the suggested name will be TYPE_NAME and NAME.
Some other kinds could be added in the future.

Each variable kind is affected by the following JavaCore options:

For a complete description of these configurable options, see JavaCore.getDefaultOptions(). To programmatically change these options, see JavaCore.setOptions(java.util.Hashtable) and IJavaProject.setOptions(java.util.Map)

Proposed names are sorted by relevance (best proposal first).
The names are proposed in the following order:

  1. Names with prefix and suffix. Longer names are proposed first
  2. Names with prefix. Longer names are proposed first
  3. Names with suffix. Longer names are proposed first
  4. Names without prefix and suffix. Longer names are proposed first

Parameters:
variableKind - specifies what type the variable is: VK_LOCAL, VK_PARAMETER, VK_STATIC_FIELD, VK_INSTANCE_FIELD or VK_STATIC_FINAL_FIELD.
baseNameKind - specifies what type the base name is: BK_NAME or BK_TYPE_NAME
baseName - name used to compute the suggested names.
javaProject - project which contains the variable or null to take into account only workspace settings.
dim - variable dimension (0 if the field is not an array).
excluded - a list of names which cannot be suggested (already used names). Can be null if there are no excluded names.
evaluateDefault - if true, the result is guaranteed to contain at least one result. If false, the result can be an empty array.
Returns:
String[] an array of names.
Since:
3.5
See Also:
JavaCore.setOptions(java.util.Hashtable), JavaCore.getDefaultOptions()

Eclipse JDT
Release 3.5

Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire