On 31.08.21 04:58, OCsite wrote:
[...]>> ...
Of course you can also redefine the class on loading, then you can
basically do whatever.

redefine is the wrong word here I guess...

Yup, I guess conceptually, there is not much difference between

(a) creating a subclass containing methods I need programmatically at
runtime, or
(b) creating a bare subclass compile-time and then add the methods when
it gets loaded.

well, you can change a final class, before loading, but you cannot
subclass it. You can combine changing the class (removing final, making
it and the methods public) with subclasssing ofcourse

Of course, it might well prove one or the other is technically much
easier. Which of these two approaches would you recommend to start with?

subclassing is easier, but you might be blocked soon

[...]
Meantime I've considered another trick, essentially (the details
slightly differ, not worth pursuing here) I found (probably) a way to
reliably trap all the exceptions caused by those non-existing accessor
methods and use proper getters/setters in the appropriate handlers. I am
afraid this approach would prove too slow, but perhaps it is worth
trying, too...

Slow well... it depends. Slow code is not bad, if not called to often or
in critical parts.

bye Jochen

Reply via email to