Will the following design prove hard to scale in the long run:
class A {
private static volatile boolean someFlag;
public void setSomeFlag(boolean newFlag) {
someFlag = newFlag;
}
public boolean getSomeFlag() {
return someFlag;
}
}
I want to do this in a project because, in my case, A
implements an interface and the interface has implementations other than A
, all of them being singletons. All implementations will have someFlag
and perform related operations (get and set). But the state of someFlag
is implementation specific, so I can't just make someFlag
a static member of interface and define static getter and setter as part of the interface itself. I want to know if it is acceptable to go with the design of the class above?