Overriding init() methods of screen

Hello,

please don’t judge me, if this is a silly question. I’m still into learning OOP with Java.

When i Override for example the Init method in a Controller of a WebModule, i noticed some of you leave the automatic generated call of the init mthod of the superclass as it is “super.init(params);”. For myself i didn’t experienced any difference when deleting it.
I also noticed in some CUBA Platform tutorials on the CUBA Website, the delete it.

So maybe i have no clue what this is about, please help me understand it.

@Override
public void init(Map<String, Object> params) {
         super.init(params);
}

Thanks in advance
Daniel

Okay… I learned to ask google… sorry for wasting your time…

Daniel

Hi Daniel,

In CUBA screens API, we usually indicate in JavaDocs that a method is a “hook” or “template method” and is intended to be overridden in subclasses. In this case it is safe to omit the super invocation. Otherwise call super.

1 Like