Example usage for org.aspectj.util Reflection invoke

List of usage examples for org.aspectj.util Reflection invoke

Introduction

In this page you can find the example usage for org.aspectj.util Reflection invoke.

Prototype

public static Object invoke(Class<?> class_, Object target, String name, Object arg1, Object arg2,
            Object arg3) 

Source Link

Usage

From source file:AroundAMain.java

License:Open Source License

public static void main(String[] args) throws ClassNotFoundException {
    AroundClosure closure = new AroundClosure() {
        public Object run(Object[] args) throws Throwable {
            //            System.out.println("run with: " + Arrays.asList(args));
            return new Integer(10);
        }//from  w  w w.j a va2 s  .c  o m
    };

    Object instance = Reflection.getStaticField(Class.forName("AroundA"), "ajc$perSingletonInstance");

    Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$1$73ebb943", // was $AroundA$46
            new Integer(10), new Boolean(true), closure);

    Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$2$a758212d", // Was $AroundA$c5
            "hello there", closure);
    Reflection.invoke(Class.forName("AroundA"), instance, "ajc$around$AroundA$3$a758212d", // Was $AroundA$150
            new String[1], closure);

}