No, there is no built-in tool in JavaSE for this.
Not much of a burden, of course, you can easily test with just a few lines.
If you really want something that you donβt write, there are different third-party libraries that will do this for you (for example, Apache Commons Lang ClassUtils, CGLIB ReflectUtils), so if you already have one of those, you can use them.
source
share