Package org.ow2.easybeans.asm

Examples of org.ow2.easybeans.asm.MethodVisitor.visitFieldInsn()


            mv.visitInsn(ATHROW);


            // if method is not null, return it
            mv.visitLabel(notNullParametersLabel);
            mv.visitFieldInsn(GETSTATIC, this.generatedClassName, "method", JAVA_LANG_REFLECT_METHOD);
            mv.visitInsn(ARETURN);

            // add try/cacth
            mv.visitTryCatchBlock(tryLabel, firstCatchLabel, firstCatchLabel, "java/lang/SecurityException");
            mv.visitTryCatchBlock(tryLabel, firstCatchLabel, secondCatchLabel, "java/lang/NoSuchMethodException");
View Full Code Here


        MethodVisitor mv = getCW().visitMethod(ACC_STATIC, "<clinit>", "()V", null, null);
        mv.visitCode();

        // private static Method method = null
        mv.visitInsn(ACONST_NULL);
        mv.visitFieldInsn(PUTSTATIC, this.generatedClassName, "method", JAVA_LANG_REFLECT_METHOD);


        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
View Full Code Here


        // interceptor++ or in fact : interceptor = interceptor + 1;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(DUP);
        mv.visitFieldInsn(GETFIELD, this.generatedClassName, "interceptor", "I");
        mv.visitInsn(ICONST_1);
        mv.visitInsn(IADD); // + 1
        mv.visitFieldInsn(PUTFIELD, this.generatedClassName, "interceptor", "I");

View Full Code Here

        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(DUP);
        mv.visitFieldInsn(GETFIELD, this.generatedClassName, "interceptor", "I");
        mv.visitInsn(ICONST_1);
        mv.visitInsn(IADD); // + 1
        mv.visitFieldInsn(PUTFIELD, this.generatedClassName, "interceptor", "I");



        // load interceptor constant to do the switch
        mv.visitVarInsn(ALOAD, 0);
View Full Code Here



        // load interceptor constant to do the switch
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, this.generatedClassName, "interceptor", "I");


        // Size
        int sizeInterceptors = this.allInterceptors.size();
View Full Code Here

            Type returnType = Type.getReturnType(interceptor.getJMethod().getDescriptor());

            // interceptor on the bean
            if (interceptor.getClassName().equals(this.beanClassName)) {
                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, this.generatedClassName, "bean", this.beanClassDesc);
                mv.visitVarInsn(ALOAD, 0);
                mv.visitMethodInsn(INVOKEVIRTUAL, this.beanClassName,
                        interceptor.getJMethod().getName(), interceptor.getJMethod().getDescriptor());

                // return object or null if the return type is void
View Full Code Here

                // return object or null if the return type is void
                returnsObject(returnType, mv);
            } else { // interceptor in another class
                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, this.generatedClassName, INTERCEPTOR + interceptorIndex ,
                        encodeClassDesc(interceptor.getClassName()));
                mv.visitVarInsn(ALOAD, 0);
                mv.visitMethodInsn(INVOKEVIRTUAL, interceptor.getClassName(),
                interceptor.getJMethod().getName(), interceptor.getJMethod().getDescriptor());
                // return object or null if the return type is void
View Full Code Here

        // then, add call to original method, ie bean.businessMethod(i,j,...);
        mv.visitLabel(switchLabels[index++]);
        // get bean object
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, this.generatedClassName, "bean", this.beanClassDesc);

        // arguments of the method
        int indexArg = 0;
        for (Type argType : this.methodArgsType) {
            mv.visitVarInsn(ALOAD, 0);
View Full Code Here

        // arguments of the method
        int indexArg = 0;
        for (Type argType : this.methodArgsType) {
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.generatedClassName, ARG + (indexArg++), argType.getDescriptor());
        }

        // Call to the renamed method only for AroundInvoke
        // LifeCycle interceptors call the original method
        String interceptedMethod = null;
View Full Code Here

     */
    public void addInvocationContextGetContextData() {
        MethodVisitor mv = getCW().visitMethod(ACC_PUBLIC, "getContextData", "()Ljava/util/Map;", null, null);
            mv.visitCode();
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.generatedClassName, "contextData", "Ljava/util/Map;");

            Label elseLabel = new Label();
            mv.visitJumpInsn(IFNONNULL, elseLabel);

            // if
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.