Understanding and Using Reflection
Summary: Reflection is a powerful language feature.
Java supports
‘structural-reflection’, which is safe to use.
With reflection, it is
possible to do two basic types of operations on code: inspection and
manipulation....
More
Understanding and Using Reflection
Summary: Reflection is a powerful language feature.
Java supports
‘structural-reflection’, which is safe to use.
With reflection, it is
possible to do two basic types of operations on code: inspection and
manipulation.
Reflection enables using ‘signature based polymorphism’
as an alternative to ‘interface based polymorphism’ in Java.
Reflection also facilitates creation of flexible and adaptable
frameworks and patterns, which is not usually possible with direct
code.
Though there are many clear advantages in using reflection,
like any other language feature, reflection can be misused.
This
article covers a few specific problems and solutions to illustrate uses
and misuses of reflection.
In programming, reflection is the ability to dynamically create, use or manipulate
classes and objects at runtime.
For example, you can create an instance of a class,
examine the class to find a specific method from that class and execute that
method with the a
Less