jOOQ / jOOR

jOOR - Fluent Reflection in Java jOOR is a very simple fluent API that gives access to your Java Class structures in a more intuitive way. The JDK's reflection APIs are hard and verbose to use. Other languages have much simpler constructs to access type meta information at runtime. Let us make Java reflection better.
http://www.jooq.org/products
Apache License 2.0
2.81k stars 376 forks source link

Add Reflect.initValue(Class) #68

Closed lukaseder closed 6 years ago

lukaseder commented 6 years ago

Sometimes, it's necessary to get an initialisation value for a given Class reference, i.e. the value that would be present as a default initialisation value after object construction:

class X {
  i int;
}

assertEquals(0, new X().i);

There doesn't seem to be a JDK method to do this. Guava has a method, though: https://stackoverflow.com/q/52988458/521799