/**
* 获得 method.
*
* @param joinPoint
* the join point
* @param klass
* the klass
* @return the method
* @deprecated 目前作用不大,将来会重构
*/
@Deprecated
protected Method getMethod(JoinPoint joinPoint,Class<? extends Annotation> klass){
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method method = methodSignature.getMethod();
if (method.isAnnotationPresent(klass)){
return method;
}
Target annotation = klass.getAnnotation(Target.class);
ElementType[] value = annotation.value();
try{
Object target = joinPoint.getTarget();
Class<? extends Object> targetClass = target.getClass();
String methodName = method.getName();
Class<?>[] parameterTypes = method.getParameterTypes();
Method m1 = targetClass.getMethod(methodName, parameterTypes);
if (m1.isAnnotationPresent(klass)){
return m1;
}
}catch (Exception e){
LOGGER.error(e.getClass().getName(), e);
}
throw new RuntimeException("No Proper annotation found.");
}
JoinPointUtilTest.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:feilong-spring
作者:
评论列表
文章目录