Can eclipse do this refactoring?
Say I have a class that has a List:
class DomainObject {
private List list;
public List getList() { return list; }
}
Then some code that uses the class needs to do this:
domainObject.getList().get(23);
I’d like to refactor to this (and have all other references do the same):
domainObject.get(23);
I’ve tried a few options but can’t seem to find a way of doing this (other than manually)
Try this:
DomainObjectcorrectly implementList(usinglistas a delegate)getList()returnthisgetList()"implements List"again keeping theget()methodAnother (simpler) option:
getList()togetMyListWithAUniqueNameAcrossTheProject()(let Eclipse update all references)"getMyListWithAUniqueNameAcrossTheProject()."by""DomainObject.get(int)