I have a class like this:
public class BukkitPlayerWrapper implements Player {
private Player p;
public BukkitPlayerWrapper(Player p) {
this.p = p;
}
}
But Player interface has a lot of methods, is there a way in intelliJ to generate code like this?
@Override
public String getDisplayName() {
return p.getDisplayName();
}
@Override
public void setDisplayName(String s) {
p.setDisplayName(s);
}
Because writing it by hand will take hours.
I'm not sure that's what you're looking for but if you have an interface e.g.
and you create a class that implements the interface and has a member variable:
you can place the caret somewhere inside the class and hit
Alt
+Insert
and it should give you this context menu:then you click on
Delegate Methods...
and you'll get this:and finally the methods you want to delegate and you'll end up with something similar to this:
hope this helped a bit (: