java类java.lang.annotation.IncompleteAnnotationException的实例源码

AnnotationInvocationHandler.java 文件源码 项目:classpath 阅读 39 收藏 0 点赞 0 评论 0
public Object invoke(Object proxy, Method method, Object[] args)
  throws Throwable
{
    String methodName = method.getName().intern();
    if (args == null || args.length == 0)
    {
        if (methodName == "toString")
        {
            return toString(type, memberValues);
        }
        else if (methodName == "hashCode")
        {
            return Integer.valueOf(hashCode(type, memberValues));
        }
        else if (methodName == "annotationType")
        {
            return type;
        }
        else
        {
            Object val = memberValues.get(methodName);
            if (val == null)
            {
                throw new IncompleteAnnotationException(type, methodName);
            }
            if (! getBoxedReturnType(method).isInstance(val))
            {
                throw new AnnotationTypeMismatchException(method,
                    val.getClass().getName());
            }
            if (val.getClass().isArray())
            {
                val = arrayClone(val);
            }
            return val;
        }
    }
    else if (args.length == 1)
    {
        if (methodName == "equals")
        {
            return Boolean.valueOf(equals(type, memberValues, args[0]));
        }
    }
    throw new InternalError("Invalid annotation proxy");
}
CoreMetaData.java 文件源码 项目:TA-Lib 阅读 27 收藏 0 点赞 0 评论 0
static private FuncInfo getFuncInfo(Method method) throws IncompleteAnnotationException {
    FuncInfo annotation = method.getAnnotation(FuncInfo.class);
    if (annotation != null) return annotation;
    throw new IncompleteAnnotationException(FuncInfo.class, "Method " + method.getName());
}
CoreMetaData.java 文件源码 项目:TA-Lib 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Returns an annotation which describes this TA function.
 * 
 * @return an @interface FuncInfo
 * @throws IncompleteAnnotationException
 */
public FuncInfo getFuncInfo() throws IncompleteAnnotationException {
    return getFuncInfo(function);
}
CoreMetaData.java 文件源码 项目:TA-Lib 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Returns an annotation which describes this TA function.
 * 
 * @return an @interface FuncInfo
 * @throws IncompleteAnnotationException
 */
public FuncInfo getFuncInfo() throws IncompleteAnnotationException {
    return getFuncInfo(function);
}


问题


面经


文章

微信
公众号

扫码关注公众号