views:

25

answers:

2

If I have an interface with a few methods. Sometimes I need to create a new implementation of the interface which wraps another instance of the interface and delegates most of the methods to the wrapped instance. Then I would change a couple of the implementations, maybe not delegating them.

A classic example would be the Collections.unmodifiableXXX() methods in the JDK which block access to the modification methods.

Does IntelliJ have any code assistance that will generate a delegate implementation of the interface and then I can just tweak a couple of methods?

+2  A: 

You can do it in two stages. First implement the interface and then introduce delegation

Visage
Thanks. To be clear the steps are.. 1) Implement interface. 2) Add target member variable that is being delegated to. 3) Use Code|Delegate and first select the member variable target and then all the methods you want delegated.
Mike Q
+1  A: 

Code|Delegate Methods

mklhmnn