public <A extends Annotation> A getAnnotation(Class<A> annotationClass)
我们经常在帮助文档中看到这样的方法,我们易知这个方法中的A是这个函数的返回值,但是
<A extends Annotation>是什么意思呢?这是解释泛型A到底是什么的,这里的A它的解释是:Annotation及Annotation的子类。

下面再解释一下泛型的一些名词:
ArrayList<E>称为泛型类型。其中的E称为类型参数,ArrayList称为原始类型。
ArrayList<String>称为参数化类型,String称为实际参数类型。

相关文章:

  • 2021-05-26
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
  • 2021-12-25
  • 2021-07-27
  • 2021-05-24
  • 2021-09-30
猜你喜欢
  • 2021-08-13
  • 2021-07-13
  • 2021-09-17
  • 2021-12-30
  • 2022-01-06
  • 2022-02-28
  • 2021-05-26
相关资源
相似解决方案