Java – combined code generation using eclipse
•
Java
Effective Java and other sources suggest that we should consider using composition over inheritance I often find myself implementing this combination by using decorator pattern and implementing forwarding methods that delegate calls to wrapper objects
However, I often find myself writing many types of simple forwarding methods:
public void myMethod(String name) { instance.myMethod(name); }
In any case, automatically generate these forwarding methods in eclipse (3.4. X)?
Solution
From the source menu, select generate delegate method It will provide you with a list of available methods for any field that can be used for forwarding the current object
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码