AnnotationMember.java 文件源码

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

项目:In-the-Box-Fork 作者:
/**
 * Validates contained value against its member definition
 * and if ok returns the value.
 * Otherwise, if the value type mismatches definition
 * or the value itself describes an error,
 * throws appropriate exception.
 * <br> Note, this method may return null if this element was constructed
 * with such value.
 *
 * @see #rethrowError()
 * @see #copyValue()
 * @return actual valid value or null if no value
 */
public Object validateValue() throws Throwable {
    if (tag == ERROR) {
        rethrowError();
    }
    if (value == NO_VALUE) {
        return null;
    }
    if (elementType == value.getClass()
            || elementType.isInstance(value)) { // nested annotation value
        return copyValue();
    } else {
        throw new AnnotationTypeMismatchException(definingMethod,
                value.getClass().getName());
    }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号