Java generics - retrieve type

后端 未结 6 600
忘掉有多难
忘掉有多难 2020-12-18 04:18
public Interface Foo{...}

Is there a way to retrieve which T was given for an implementation of Foo?

For example,

6条回答
  •  醉话见心
    2020-12-18 04:47

    [edit] Ok, apparently partially possible. Good explanation of how to do it, (including an improvement upon the method posted by SingleShot): http://www.artima.com/weblogs/viewpost.jsp?thread=208860

提交回复
热议问题