JavaTypeAnalyzer.java 文件源码

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

项目:jaxrs-analyzer 作者:
/**
 * Checks if the method is public and non-static and that the method is a Getter.
 * Does not allow methods with ignored names.
 * Does also not take methods annotated with {@link XmlTransient}.
 *
 * @param method The method
 * @return {@code true} if the method should be analyzed further
 */
private static boolean isRelevant(final Method method, final XmlAccessType accessType) {
    if (method.isSynthetic() || !isGetter(method))
        return false;

    final boolean propertyIgnored = ignoredFieldNames.contains(extractPropertyName(method.getName()));
    if (propertyIgnored || hasIgnoreAnnotation(method) || isTypeIgnored(method.getReturnType())) {
        return false;
    }

    if (isAnnotationPresent(method, XmlElement.class))
        return true;

    if (accessType == XmlAccessType.PROPERTY)
        return !isAnnotationPresent(method, XmlTransient.class);
    else if (accessType == XmlAccessType.PUBLIC_MEMBER)
        return Modifier.isPublic(method.getModifiers()) && !isAnnotationPresent(method, XmlTransient.class);

    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号