Is there a easy way to extract a interface from a Java class, including public methods of super classes? -
is there easy way extract interface java class such includes public methods of super classes. class im trying extract interface has several layers of super classes, each 1 lots of methods. don't need interface each of parent classes.
currently i'm using intelij idea ide. extracts public methods of current class, when extracting interface. if u guys can tell me tool or easy way extract interface, great help.
eclipse doesn't offer superclass methods in "extract interface" refactoring. , correct, because shouldnt implement interface , implement methods in superclass!
you want this:
public interface interfaceforb { void b(); void a(); } public class { public void a(){} } public class b extends implements interfaceforb{ public void b(){} }
yes, compiles. it's awful style, because says, b
implements interface, not true, because a()
method implemented in class a
.
my strong advice: use refactorings offered intellij, extract methods interface really implemented actual class. implement b
given example implements all interface methods:
public class b extends implements interfaceforb{ public void b(){} public void a(){ super(); } }
and intellij (and eclipse) can extract interface way want it.
Comments
Post a Comment