如何使用idea看注解的实现

21 篇文章 0 订阅

如何使用idea看注解的实现

需求

想看看注解 @AliasFor 是如何实现的

精彩文章

全局寻找

ALT + F7

在这里插入图片描述

选择.class

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CzzChy6y-1626148400349)(/2021/img/选择class就可以了.png)]

点击查看这两个方法

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cyA59fMq-1626148400352)(/2021/img/点击查看这两个方法.png)]

查看具体的实现

    /**
        * Create an {@code AliasDescriptor} <em>from</em> the declaration
        * of {@code @AliasFor} on the supplied annotation attribute and
        * validate the configuration of {@code @AliasFor}.
        * @param attribute the annotation attribute that is annotated with
        * {@code @AliasFor}
        * @return an alias descriptor, or {@code null} if the attribute
        * is not annotated with {@code @AliasFor}
        * @see #validateAgainst
        */
    @Nullable
    public static AliasDescriptor from(Method attribute) {
        AliasDescriptor descriptor = aliasDescriptorCache.get(attribute);
        if (descriptor != null) {
            return descriptor;
        }

        AliasFor aliasFor = attribute.getAnnotation(AliasFor.class);
        if (aliasFor == null) {
            return null;
        }

        descriptor = new AliasDescriptor(attribute, aliasFor);
        descriptor.validate();
        aliasDescriptorCache.put(attribute, descriptor);
        return descriptor;
    }
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值