简体   繁体   中英

Delegates code generation Intellij Idea

I've met a situation, where I had to create five methods like:

public boolean addNames(String object) {
    return mNames.add(object);
}

And I tried to use code generation, but "Create delegates" return me just add(Object o) method, where can I change template to create delegates like getters and setters (I'm about smart prefixes).

When I tried to find a solution, I've found this question, it's nice too, but it's old, anybody knows solution to this too? Customizing of code generation in IntelliJ IDEA

Best wishes, Anton

The "Delegate" action in IntelliJ IDEA performs a specific operation: it forwards methods to another object which has methods with the same signature and parameters. The code generation logic is not based on a template and cannot be customized.

(Generally, speaking, when the number of methods you need to create is five, it's much faster to create them by hand than to try to write a code generation template to create them for you.)

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