Reputation: 132
I'm trying to extend eclipse's rename refactoring to call another rename refactoring.
public class Person {
...
}
public class PersonDAO {
public List<Person> getPersonByName(String name) {
...
}
}
After renaming the class Person to User, I want methods like getPersonByName
to be renamed to getUserByName
.
I've extended RenameParticipant and tried to do it by using both JDT rename refactoring and ASTRewrite.
The problem is the changes I create conflict with the original rename refactoring changes.
I couldn't use postCreateChange
(it seems the basic processor only returns null) and now I'm stuck.
Any help is much appreciated.
Upvotes: 7
Views: 369
Reputation: 55
There is no possibility to change the String "Person" defined in methods by the new value "User" with refactoring.
But you can use Ctrl+H to search on the full workspace the needed String and replace it with the new Value.
When you click on Replace button, Eclipse will ask you the new value that will raplace the serched String.
Upvotes: 1
Reputation: 14164
Better suggestions:
1) Use Hibernate. You'll then be using the Criteria API, won't need to specify "Person" redundantly, and can attach other restrictions/criteria in a modular way -- good for List/ Search pages.
2) Call your API getByName(). List people = personDao.getPersonByName("...") is bit redundantly repeatedly repetitive, already.
The whole thing looks kinda like the 'wrong way' to do DAOs, database access, or persistence, which I've seen in previous projects. The combination of overly-wordy, yet inflexible & low-utility criteria, just reminds me of manually written persistence or services done badly in the mid-90s.
Upvotes: 1