public final class VariableNaming
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
VariableNaming.NameFormater |
Modifier and Type | Field and Description |
---|---|
static VariableNaming.NameFormater |
CONSTANT_FORMATER |
static VariableNaming.NameFormater |
FIELD_FORMATER |
static VariableNaming.NameFormater |
PARAMETER_FORMATER |
static VariableNaming.NameFormater |
VARIABLE_FORMATER |
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 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> |
suggestConstantNames(SourceElement sourceElement, java.lang.String typeName) |
static java.util.List<java.lang.String> |
suggestFieldNames(SourceElement sourceElement, java.lang.String typeName) |
static java.util.List<java.lang.String> |
suggestNamesFromCamelWord(java.lang.String shortName) |
static java.util.List<java.lang.String> |
suggestNamesFromCamelWord(java.lang.String shortName, VariableNaming.NameFormater nameFormater) |
static java.util.List<java.lang.String> |
suggestParameterNames(SourceElement sourceElement, java.lang.String typeName) |
static java.util.List<java.lang.String> |
suggestVariableNames(SourceElement sourceElement, java.lang.String typeName) |
public static final VariableNaming.NameFormater FIELD_FORMATER
public static final VariableNaming.NameFormater CONSTANT_FORMATER
public static final VariableNaming.NameFormater VARIABLE_FORMATER
public static final VariableNaming.NameFormater PARAMETER_FORMATER
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)
public static java.util.List<java.lang.String> suggestNamesFromCamelWord(java.lang.String shortName, VariableNaming.NameFormater nameFormater)
public static java.util.List<java.lang.String> suggestVariableNames(SourceElement sourceElement, java.lang.String typeName)
public static java.util.List<java.lang.String> suggestParameterNames(SourceElement sourceElement, java.lang.String typeName)
public static java.util.List<java.lang.String> suggestFieldNames(SourceElement sourceElement, java.lang.String typeName)
public static java.util.List<java.lang.String> suggestConstantNames(SourceElement sourceElement, java.lang.String typeName)
public 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 sourceElement
sourceElement
-fieldName
-public static boolean isFieldShadowing(SourceElement element, java.lang.String newVariableName)
element
- A formal parameter or local variablenewVariableName
- The new element name