class SomeClass : ConcreteView {
var condition : Boolean = false
}
I want to prevent any function calls on SomeClass if condition is true.
I tried doing this with a Java Proxy but that requires an interface, which complicates things because SomeClass extends ConcreteView (Which isn’t an interface).
It can’t give a compile-time error, presumably, as the compiler can’t tell (in general) whether the property will be true at runtime.
Do you want calls to give some exception or other throwable? Or to be ignored, and execution continue after the call? Or something else?
Also, note that your class is free to implement any interfaces you like, even if has a parent, as long as it provides the relevant methods (or is abstract).
If someClass.someFunction() is called and condition is true, it should just do nothing.
If someClass.someFunction() is called and condition is false, it should execute as normal.
This should be the behavior for any function called on that class.
ConcreteView is not a class I own, so interfacing it out will be a pain.