Refactor: Extract Interface

Issue #2040 duplicate
Frans Flippo created an issue

I’m working on introducing proper service interfaces for my org’s service layer and since some of the current service classes are huge with tens of methods, a Refactor → Extract Interface like in IDEA’s Java feature set would be such a time saver!

I know there are other refactor issues open, but I hadn’t seen Extract Interface mentioned explicitly yet.

Iterations

A first version could just create a new interface class with the signatures of all the public methods of the source class in it, and add an implements <INTERFACE> to the source class’s class definition.

Future versions could be fancier, like replacing uses of the implementation class with uses of the interface like in IDEA’s Java Extract Interface feature, or allowing the user to select which public methods to include, but that’s less urgent for me.

Thanks for considering!

Related to:

Comments (4)

  1. Scott Wells repo owner

    Please see the linked issue for the original enhancement request for interface extraction.

  2. Frans Flippo reporter

    Ah, thanks. I searched on “extract interface” and didn’t find this issue. I guess Bitbucket issues needs to improve their search functionality a bit.

  3. Log in to comment