public final class VariableNaming
extends java.lang.Object
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
VariableNaming.VariableType
Enum of the various variable types that names can be generated for. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static java.lang.String | 
canIntroduceField(SourceElement sourceElement,
                 java.lang.String fieldName)
Verifies if a field can added introduced to the class that contains the  
SourceElement. | 
static boolean | 
canIntroduceVariable(SourceElement sourceElement,
                    java.lang.String variableName)  | 
static void | 
fillWithMembers(SourceElement element,
               java.util.HashSet existingNames)
Fills the set with the existing member declarations visible from the sourceElement. 
 | 
static void | 
fillWithParentVariableDeclaration(SourceElement sourceElement,
                                 java.util.HashSet<java.lang.String> existingNames)
Fills the set with the existing variable declarations visible from the sourceElement 
 | 
static java.lang.String | 
format(VariableNaming.VariableType variableType,
      java.lang.String name)
Format the given name for the code style of the given variableType. 
 | 
static boolean | 
isFieldShadowing(SourceElement element,
                java.lang.String newVariableName)
Checks if the new name of a formal parameter or local variable 
 would shadow a field within its scope. 
 | 
static java.util.List<java.lang.String> | 
suggestNames(SourceElement sourceElement,
            java.lang.String typeName,
            VariableNaming.VariableType variableType,
            java.lang.String currentName)
Suggest names for the given source element. 
 | 
static java.util.List<java.lang.String> | 
suggestNamesFromCamelWord(java.lang.String shortName,
                         VariableNaming.VariableType variableType)
Suggest names based on the given word (in camel case). 
 | 
public static java.lang.String format(VariableNaming.VariableType variableType, java.lang.String name)
variableType - name - public static boolean canIntroduceVariable(SourceElement sourceElement, java.lang.String variableName)
variableName does not already represent something at sourceElement.
         Something can be a variable name, a field name, a class name, ...public static java.util.List<java.lang.String> suggestNamesFromCamelWord(java.lang.String shortName,
                                                                         VariableNaming.VariableType variableType)
shortName - variableType - public static java.util.List<java.lang.String> suggestNames(SourceElement sourceElement, java.lang.String typeName, VariableNaming.VariableType variableType, java.lang.String currentName)
sourceElement - get suggestions for this elementtypeName - optional type name to get more suggestions forvariableType - the type of variable being namedcurrentName - do not modify suggestions (e.g. add a" _2") if they clash with this namepublic static void fillWithMembers(SourceElement element, java.util.HashSet existingNames)
public static void fillWithParentVariableDeclaration(SourceElement sourceElement, java.util.HashSet<java.lang.String> existingNames)
public static java.lang.String canIntroduceField(SourceElement sourceElement, java.lang.String fieldName)
SourceElement.
 It will verify that the field name is a valid field identifier, that it does not already exist and that it does
 not override a variable in the method that contains the sourceElementsourceElement - fieldName - public static boolean isFieldShadowing(SourceElement element, java.lang.String newVariableName)
element - A formal parameter or local variablenewVariableName - The new element name