开发者

Is there an updated javabean reflection library that includes generics?

Before re-inventing the wheel, I thought I'd see if an开发者_高级运维yone is aware of an updated version of something like apache commons-beanutils (basically interested in using reflection-based services for populating and extracting bean values), especially one that supports generics.


I don't believe that there is any current library which allows reflection of Java generics. When Java generics were introduced in Java 1.5, they were implemented in the compiler but were not implemented in the VM. So you have a problem of type-erasure when trying to reflect upon a class which implements generics as the types are only visible at compile time and not at runtime. To see more about this and possible work-arounds, check out:

  • Super type tokens
  • Reflecting generics
  • Scala's way of working around reified types
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜