I have a super super (grandparent) abstract bean class calling loadData() method in its init() method like this:
public abstract class BaseFwkPageController extends PageControllerSupport {
public String init(){
cleanSession();
loadData();
return initNavigation;
}
public abstract void loadData();
// ...
}
now I don’t want this loadData() method to be called in the sub subclass (child). I can’t change the super class. How can I achieve this?
You can’t hide the method, reduce its visibility or prevent anyone from calling.
However you can do something like this in your subclass:
Alternatively, you could put in an
interface, exposing only what may be called through the interface.This way you will have complete control.