Learn Reflection with Java

Learn Reflection with Java

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 29 Lessons (4h 9m) | 1.05 GB

A well-rounded Java programmer should know reflection, when to use it, and more importantly, when not to use it.

Reflection is a powerful Java feature that can be used to expand the capabilities of a program, to examine the class or object internals at runtime.

Java Reflection is quite powerful and can be very useful. Java Reflection makes it possible to inspect classes, interfaces, fields, and methods at runtime, without knowing the names of the classes, methods, etc. at compile time. Java Reflection is useful for creating generic code, implementing dynamic frameworks, and testing and debugging. In this course, we start with the basics, then show how reflection works with the more modern language features such as sealed classes and records. We also show how arrays can be manipulated and created via reflection. Lastly, we show MethodHandle and VarHandle. Learn from hands-on exercises that are followed by demos revealing the solutions.

Learn How To:

  • Inspect a class and find methods, fields, and constructors at runtime
  • Call methods, change fields, even if they are private
  • Write more general code that can be reused in many different contexts
  • Understand VarHandles and MethodHandles and know when to use them
  • Know how sealed classes and records can be inspected via reflection
Table of Contents

Introduction
1 Learn Reflection with Java Introduction

Lesson 1 Introduction to Reflection
2 Learning objectives
3 Who Am I
4 Why learn reflection
5 Class Class
6 Method
7 Modifier and AccessFlag
8 Constructor
9 Generics
10 Nested classes
11 Sealed classes
12 Records
13 Exercise

Lesson 2 Deep Reflection
14 Learning objectives
15 Making private members accessible
16 Performance considerations

Lesson 3 Arrays
17 Learning objectives
18 Accessing elements
19 Creating new
20 Exercise

Lesson 4 java.lang.invoke
21 Learning objectives
22 MethodHandles.Lookup
23 privateLookupIn()
24 MethodHandle
25 MethodType
26 VarHandle
27 Unreflecting
28 Exercises

Summary
29 Learn Reflection with Java Summary

Homepage