问题
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?
回答1:
You can do it in two stages. First implement the interface and then introduce delegation
回答2:
Code|Delegate Methods
来源:https://stackoverflow.com/questions/3753349/does-intellij-idea-have-a-create-wrapper-code-generator