How to get field values with Reflection and with direct memory access in Java

To get field values from an object in Java we are going to use Fields component of Burningwave Core, a fully independent, advanced, free and open source Java frameworks building library that is useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more…

To use Burningwave Core you should simply add the following to your projects dependencies:

Fields component uses to cache all fields for faster access and in this code snippet we show how to handle the fields of any Java object even of anonymous type:

In this short article we have learned how to get fields of Java objects and how to handle them; the complete source is available at this link and for more articles about Burningwave Core you can go to the main page.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store