Reflection
Reflection inspects and manipulates type information at runtime — class names, fields, methods, annotations — dynamically invoking methods and creating instances.
Purpose
Runtime type introspection and dynamic manipulation, powering frameworks and serialization.
Mechanism
Obtains the Class object via the reflection API, enumerates fields/methods/annotations, dynamically invokes methods, constructs instances, and accesses fields. Java/C# reflection is powerful but has performance overhead. Go uses interface type assertions.
Use cases
- Framework implementation
- Serialization
- Dependency injection