How to get the initialisation value for a Java Class reference

后端 未结 4 972
别那么骄傲
别那么骄傲 2021-01-04 09:52

I have a Class reference for an arbitrary type. How to get that type\'s initialisation value? Is there some library method for this or do I have to rol

4条回答
  •  离开以前
    2021-01-04 10:37

    For completeness' sake, this is something that I think belongs to a reflection API, so I have added it to jOOR through #68

    Object init = Reflect.initValue(klass);
    

    Notably, Guava has a similar tool and there are JDK utilities that can do this as well

提交回复
热议问题