Running on Java 19-ea+28-2110 (Preview)
Home of The JavaSpecialists' Newsletter

java.lang.reflect.* Course

Write Dynamically Reusable Code in Java

As a Java programmer, if we know how reflection works, we can save a lot of time and effort. Instead of writing versions of the same code over and over again, we can write a single method that does what we want in a general way. 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.

Benefits of Course

  • Save programming time by writing dynamic solutions to reoccurring problems.
  • Learn how dynamic coding via reflection affects Java performance and correctness.
  • A well-rounded Java programmer should know reflection, when to use it, and more importantly, when not to use it.

What you'll learn and how you can apply it

By the end of the course, you'll understand:

  • Basic reflection: Class, Method, Field, Constructor
  • More advanced reflection concepts: generics, records, sealed classes, nested classes, modules
  • Deep reflection in Java, which allows changes to private final fields
  • How to manipulate arrays with reflection
  • MethodHandle and VarHandle

And you'll be able to:

  • Inspect a class and find methods, fields and contructors 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

This live event is for you because...

  • You want to be considered a guru by your colleagues and peers, writing "magical" Java code that dynamically adapts itself to change.
  • You want to save time in your development by writing highly reusable code.
  • You are in the top tier of developers and want to learn how to write libraries and frameworks

Who should take this course?

  • Students should be very familiar with Java 11, understanding data structures, object orientation, recursion and modern Java syntax.
  • Prior experience with reflection is a bonus, but not necessary.

java.lang.reflect.* Course Enquiry


Prerequisites

This course is aimed at intermediate to advanced Java programmers wanting to learn what tricks java.lang.reflect has to offer and how to best use them.

Pricing Options

We have several options for you to join this course:

1. Open Enrollment Classroom Course:

We regularly offer this course as a classroom course in Chania on the Island of Crete. Price for the course is €695 per student.

We also offer this course as an open enrollment live remote course that you can attend from anywhere. Price is €469 per student.

Please contact us if you have would like to make a booking or if you have any questions.

2. In-person in-house Course:

Presented at your company in-person by one of our Certified JavaSpecialist Instructors. Price is €3289 for up to 10 students, above that is an additional €295 per student, plus the travel expenses of the instructor.

  • Example 1: Course with 8 students taught on-site at your company, price is €3289. Price per student is €411.
  • Example 2: Course with 12 students taught on-site at your company, price is €3879. Price per student is €323.
  • Example 3: Course with 18 students taught on-site at your company, price is €5649. Price per student is €313.

Please contact us if you have any questions.

3. Remote Instructor-Led Course:

Presented via video conference to your team of programmers by the author of the course. Price is €2233 for up to 10 students, above that is an additional €198 per student.

  • Example 1: Course with 8 students taught remotely via video conference, price is €2233. Price per student is €279.
  • Example 2: Course with 12 students taught remotely via video conference, price is €2629. Price per student is €219.
  • Example 3: Course with 24 students taught remotely via video conference, price is €5005. Price per student is €208.

Please contact us if you have any questions.

4. Remote Webinar-Style Course:

Presented via live webinar video conference to your team of programmers by the author of the course. This is intended for a larger audience from 50 up to 200 students. Students ask questions via text chat. The price for this course presented as a webinar is €7875 for the first 50 students, thereafter €135 per student.

  • Example 1: Course with 40 students taught on-site at your company, price is €7875. Price per student is €196.
  • Example 2: Course with 60 students taught on-site at your company, price is €9225. Price per student is €153.
  • Example 3: Course with 150 students taught on-site at your company, price is €21375. Price per student is €142.

Please contact us if you have any questions.

5. Self-Paced Course:

This course is currently not available as a self-paced course.

Please contact us if you have any questions.

* Prices exclude EU VAT and withholding taxes where applicable. Please contact us for an exact quote for your country.

Open Courses

All our courses are offered as in-house courses. Please contact us on heinz@javaspecialists.eu.

* Price is excluding EU VAT where applicable. Please contact us for an exact quote for your country.

Detailed Outline

The emphasis of this training workshop is to learn what java.lang.reflect has to offer. Here is our outline:

Segment 1: Introduction to Reflection
  • Welcome
  • Why learn reflection?
  • Class Class
    • Method
    • Field
    • Constructor
    • Generics
  • Nested classes
  • Sealed classes
  • Records
  • Exercise
  • Q&A Break (7 minutes)
Segment 2: Deep Reflection
  • Making private members accessible
  • Dealing with exceptions
  • Performance considerations
  • Exercise
  • Q&A Break (7 minutes)
Segment 3: Arrays (45 minutes)
  • Accessing elements
  • Creating new
  • Exercise
  • Q&A Break (7 minutes)
Segment 4: java.lang.invoke
  • MethodHandles.Lookup
    • privateLookupIn()
  • MethodHandle
    • MethodType
  • VarHandle
  • Converting from Method to MethodHandle
  • Performance of MethodHandle and VarHandle
  • Exercise
  • Conclusion

About the Author

Heinz Kabutz Java Conference Speaker

Java Champion, author of the Javaspecialists Newsletter, conference speaking regular... About Heinz

Superpack '22

Superpack '22 Our entire Java Specialists Training in one huge bundle more...

Free Java Book

Dynamic Proxies in Java Book

110% Money-back Guarantee

Should you not be satisfied with the quality of the training or the delivery, we will gladly refund you 100% of the course fees. This needs to be brought to our attention within the first 4 hours of the course and a chance should be given to correct whatever you are not satisfied with. If you are still not satisfied, we will refund you 100% of the course fees, plus we will pay our own travel expenses. The training material then remains the property of JavaSpecialists.EU.


Cancellation Policy

If the course is cancelled more than two weeks before the start of the course, a 10% cancellation fee of the fees will apply, plus any non-refundable travel expenses incurred by the trainer.

If the course is cancelled within two weeks of the start of the course, a 50% cancellation fee of the fees will apply, plus any non-refundable travel expenses incurred by the trainer.

No refund will be given to cancellations during the course.


Java Training

We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations.

Java Consulting

We can help make your Java application run faster and trouble-shoot concurrency and performance bugs...

Java Emergency?

If your system is down, we will review it for 15 minutes and give you our findings for just 1 € without any obligation.