I’ve method which I inherit from the base class.
I’ve 5 class that inherit the method and override it but doing the same,
Now I need to change all the methods to support additional scenario according to envoriment variable
//specific implications
@Override
protected boolean prepareDirectory(Configuration configuration, Logger logger) throws Exception
//logic here as before
if(env===“global”) {
//do something
}
}
Of course I can do this if inside all the class which works but there is a better approach to overcome this.
Since all the 5 class should use the same logic inside the new if
.
if(env===“global”){
is not valid Java. Are you confusing Java and JavaScript? These are two different programming languages.@Override
,protected
,boolean
,throws
, and types on the parameters all suggest Java, not JavaScript.