How to implement unimplemented methods to all child classes in eclipse

前端 未结 3 647
离开以前
离开以前 2021-01-02 06:30

As you know, eclipse provides with a nice way to implement unimplemented methods if a child class does not have them implemented. Is there any way to apply this to all child

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-02 06:52

    For Android Studio guys below is the workaround for it, Add this method in your interface or abstract class,

    @Override
            public void methodInInterfaceOrAbstract()
            {
                // this must me in interface or abstract class which will be implemented by child classes 
            }
    

    Then right click the java file, select the option "Refactor" then select the option "Push members down". Select the method which you want to push down to all child classes and click refactor. Your new method added in interface or abstract class will be moved to all child classes. Now you need to add the declaration of the method in interface or abstract class again as the method was moved to all child classes.

提交回复
热议问题