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");
}
AnnotationInvocationHandler.java 文件源码
java
阅读 39
收藏 0
点赞 0
评论 0
项目:classpath
作者:
评论列表
文章目录