Recently I've been restructuring a Java code of mines trying to eliminate, wherever possible, static
stuff (variables and methods) and replace it with a better coding. I also moved my first steps in the Reflection framework, and noticed that it allows me to do some things1 that, at first, I could only achieve with static
things (or, perhaps, it's how I see it). But, while I've been reading that the use static
stuff isn't too much recommended, it seems not to be the same with Reflection.
So, I'm asking: is it a licit (to be read: recommended) use of Reflection the invocation of a class method by java.lang.reflect.Method.invoke()
in replace of a static
method call like CustomClass.customMethod()
to retrieve a value from that method?
1 like dinamically accessing to classes content
Aucun commentaire:
Enregistrer un commentaire