Package org.ow2.easybeans.asm

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


        Label l17 = new Label();
        mv.visitJumpInsn(IFEQ, l17);
        Label l18 = new Label();
        mv.visitLabel(l18);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, classAnnotationMetadata.getClassName(), "getEasyBeansStatefulID", "()Ljava/lang/Long;");
        mv.visitVarInsn(ALOAD, FIVE);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "equals", "(Ljava/lang/Object;)Z");
        mv.visitJumpInsn(IFEQ, l17);
        mv.visitInsn(ICONST_1);
        mv.visitInsn(IRETURN);
View Full Code Here


        Label l18 = new Label();
        mv.visitLabel(l18);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, classAnnotationMetadata.getClassName(), "getEasyBeansStatefulID", "()Ljava/lang/Long;");
        mv.visitVarInsn(ALOAD, FIVE);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "equals", "(Ljava/lang/Object;)Z");
        mv.visitJumpInsn(IFEQ, l17);
        mv.visitInsn(ICONST_1);
        mv.visitInsn(IRETURN);
        mv.visitLabel(l17);
        mv.visitInsn(ICONST_0);
View Full Code Here

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

        // Call super constructor
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");

        // Build instance of interceptors
        for (String interceptor : this.allInterceptors) {
            mv.visitVarInsn(ALOAD, 0);
            mv.visitTypeInsn(NEW, interceptor);
View Full Code Here

        // Build instance of interceptors
        for (String interceptor : this.allInterceptors) {
            mv.visitVarInsn(ALOAD, 0);
            mv.visitTypeInsn(NEW, interceptor);
            mv.visitInsn(DUP);
            mv.visitMethodInsn(INVOKESPECIAL, interceptor, "<init>", "()V");
            mv.visitFieldInsn(PUTFIELD, this.generatedClassName, getField(interceptor), encodeClassDesc(interceptor));
        }

        // need to add return instruction
        mv.visitInsn(RETURN);
View Full Code Here

                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, this.generatedClassName, fieldName, encodeClassDesc(interceptor));
                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, this.generatedClassName, "easyBeansContext",
                        EZB_EJBCONTEXT_DESC);
                mv.visitMethodInsn(INVOKEVIRTUAL, interceptor, "setEasyBeansContext",
                        "(" + EZB_EJBCONTEXT_DESC + ")V");

                // interceptorXX.injectedByEasyBeans();
                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, this.generatedClassName, fieldName, encodeClassDesc(interceptor));
View Full Code Here

                        "(" + EZB_EJBCONTEXT_DESC + ")V");

                // interceptorXX.injectedByEasyBeans();
                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, this.generatedClassName, fieldName, encodeClassDesc(interceptor));
                mv.visitMethodInsn(INVOKEVIRTUAL, interceptor, "injectedByEasyBeans", "()V");
            }
        }
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
View Full Code Here


            // if the factory is not null, skip the code and go the easyBeansFactoryNotNullLabel label
            Label easyBeansFactoryNotNullLabel = new Label();
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansFactory", "()Lorg/ow2/easybeans/api/Factory;");
            mv.visitJumpInsn(IFNONNULL, easyBeansFactoryNotNullLabel);

            // factory is null, needs to call the original/renamed method
            Type[] args = Type.getArgumentTypes(method.getJMethod().getDescriptor());
            mv.visitVarInsn(ALOAD, 0);
View Full Code Here

                }
                methodArg++;
            }

            // Call the original method
            mv.visitMethodInsn(INVOKEVIRTUAL,  this.classAnnotationMetadata.getClassName(), MethodRenamer.encode(method.getMethodName()), method.getJMethod().getDescriptor());

            // Cast and return value
            Type returnType = Type.getReturnType(method.getJMethod().getDescriptor());
            CommonClassGenerator.addReturnType(returnType, mv);
            // if the factory is not null, skip the previous code
View Full Code Here

            mv.visitTryCatchBlock(tryLabelStart, l1, l2, "java/lang/Exception");
            // Add bean (as first argument)
            mv.visitVarInsn(ALOAD, 0);
            // Test if invocation context factory is null
            // If there is no invocation context factory, jump to the end
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansInvocationContextFactory", "()Lorg/ow2/easybeans/api/interceptor/EZBInvocationContextFactory;");
            Label labelNoInvocationContextFactory = new Label();
            mv.visitJumpInsn(IFNULL, labelNoInvocationContextFactory);

            // Begin of the try block
            mv.visitLabel(tryLabelStart);
View Full Code Here

            // Begin of the try block
            mv.visitLabel(tryLabelStart);
            mv.visitVarInsn(ALOAD, 0);

            // There is an invocation context factory, get it
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansInvocationContextFactory", "()Lorg/ow2/easybeans/api/interceptor/EZBInvocationContextFactory;");
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 0);
            // Get the interceptor manager
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansDynamicInterceptorManager", "()Lorg/ow2/easybeans/api/interceptor/EZBInterceptorManager;");
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.