zoukankan      html  css  js  c++  java
  • aspectj 获取 连接点 方法!

    public static Method getMethod(JoinPoint joinPoint) {
            Method method = null;
            String name = joinPoint.getSignature().getName();
    
            try {
            // 这才是 正统!
                MethodSignature signature = (MethodSignature) joinPoint.getSignature();
                Class[] types = signature.getParameterTypes();
    
                joinPoint.getSignature();
                method = joinPoint.getTarget().
                        getClass().getMethod(name,types);
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
            return method;
        }

     多个连接点--

    @Before("@annotation(cloud.cjy.travel.module.common.annotation.CjyAspect) || within(@cloud.cjy.travel.module.common.annotation.CjyAspect *)")

    或者:
    
    
    private static MethodSignature getMethodSignature(JoinPoint joinPoint) {
    Signature signature = joinPoint.getSignature();
    return (MethodSignature) signature;
    }



    public
    static Method getMethod(JoinPoint joinPoint) { MethodSignature methodSignature = getMethodSignature(joinPoint); return methodSignature.getMethod(); }
  • 相关阅读:
    Grand Central Dispatch-thread pool pattern
    POSIX Threads
    Event-driven programming-main loop
    Data type-数据类型
    软件的动与静
    对封装好的视图进行动态修改
    编程语言进化
    Type system
    Run-time type information--RTTI
    Type system-Type checking
  • 原文地址:https://www.cnblogs.com/whm-blog/p/11098807.html
Copyright © 2011-2022 走看看