Problem:
Having a large number of classes which have attributes defined with names where the first character is uppercase.
Example:
class FirstClass {
private Integer FirstValue;
private Double SecondValue;
private String ThirdValue;
public Integer getFirstValue() {
return FirstValue;
}
public Double getSecondValue() {
return SecondValue;
}
public String getThirdValue() {
return ThirdValue;
}
public void setFirstValue(Integer newVal) {
FirstValue = newVal
}
..
}
Currently I have setup a structural search template which looks like this:
class $class$ {
private $FieldType$ $Field$;
public $FieldType$ $MethodCallGet$() {
return $Field$;
}
public void $MethodCallSet$($FieldType$ $parameter$) {
$Field$ = $parameter$;
}
}
I have setup the variables like the following:
$class$
:text=^(XYZ|ABC).*
$FieldType$
:all fields of the class
$Field$
:[A-ZÄÖÜ][a-zA-Z0-9_ÄÜÖäüÖ]+
$MethodCallGet$
:text=^get.*
$MethodCallSet$
:text=^set.*
So first it will find the attributes which have the first character in uppercase, but unfortunately it will only find a single attribute in each class including it's getter/setter.
1. Question:
How can I find all attributes including it's getter/setter method?
2. Question:
How can I replace the attributes with it's change counterparts. Changed the first character only to lowercase. Also within the getter/setters?