简体   繁体   中英

Does IntelliJ IDEA have a Create Wrapper code generator

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?

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

Code|Delegate Methods

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM