Annotations.java 文件源码

java
阅读 42 收藏 0 点赞 0 评论 0

项目:Stdlib 作者:
/**
 * Returns a set of meta annotations associated with the given annotation
 * bundle. This will suppress {@link java.lang.annotation.Retention} and
 * {@link java.lang.annotation.Target}. The supplied annotation will be
 * the first annotation included in the returned set.
 */
public static Set<Annotation> getMetaAnnotations(Annotation bundle)
{
   Set<Annotation> result = Sets.newLinkedHashSet();
   result.add(Objects.notNull(bundle));
   for (Annotation a : bundle.annotationType().getDeclaredAnnotations()) {
      // minor optimization: by-pass 2 common JDK meta-annotations
      if ((a instanceof Target) || (a instanceof Retention)) {
         continue;
      }
      result.add(a);
   }
   return result;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号