Package org.ow2.easybeans.asm

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


        // Now, set the attributes of the class
        // this.bean = bean
        int argBean = arg++;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, argBean);
        mv
                .visitFieldInsn(PUTFIELD, this.generatedClassName, "bean", encodeClassDesc(this.classAnnotationMetadata
                        .getClassName()));


        // this.factory = bean.getEasyBeansFactory();
View Full Code Here


        // this.factory = bean.getEasyBeansFactory();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, argBean);
        mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansFactory",
                "()Lorg/ow2/easybeans/api/Factory;");
        mv.visitFieldInsn(PUTFIELD, this.generatedClassName, "factory", "Lorg/ow2/easybeans/api/Factory;");


        // this.interceptorManager = bean.getEasyBeansInterceptorManager();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, argBean);
View Full Code Here

        // this.interceptorManager = bean.getEasyBeansInterceptorManager();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, argBean);
        mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansInterceptorManager",
                "()" + encodeClassDesc(this.interceptorManagerClassName));
        mv.visitFieldInsn(PUTFIELD, this.generatedClassName, "interceptorManager",
                encodeClassDesc(this.interceptorManagerClassName));

        // And now, the attributes corresponding to the arguments of the method
        // it will do : this.ARG0 = xxx;
        int methodArg = 0;
View Full Code Here

        int methodArg = 0;
        for (Type type : this.methodArgsType) {
            mv.visitVarInsn(ALOAD, 0);
            int opCode = putFieldLoadOpCode(type.getSort());
            mv.visitVarInsn(opCode, arg++);
            mv.visitFieldInsn(PUTFIELD, this.generatedClassName, ARG + (methodArg++), type.getDescriptor());
            // Double and Long are special parameters
            if (opCode == LLOAD || opCode == DLOAD) {
                arg++;
            }
        }
View Full Code Here

        for (IJClassInterceptor interceptor : this.allInterceptors) {
            // Only if interceptor is not in the bean class
            if (!interceptor.getClassName().equals(this.beanClassName)) {
                mv.visitVarInsn(ALOAD, 0);
                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, this.generatedClassName, "interceptorManager",
                        encodeClassDesc(this.interceptorManagerClassName));
                String getterName = "get" + interceptor.getClassName().replace("/", "");
                mv.visitMethodInsn(INVOKEVIRTUAL, this.interceptorManagerClassName, getterName, "()"
                        + encodeClassDesc(interceptor.getClassName()));
                mv.visitFieldInsn(PUTFIELD, this.generatedClassName, INTERCEPTOR + (index++), encodeClassDesc(interceptor
View Full Code Here

                mv.visitFieldInsn(GETFIELD, this.generatedClassName, "interceptorManager",
                        encodeClassDesc(this.interceptorManagerClassName));
                String getterName = "get" + interceptor.getClassName().replace("/", "");
                mv.visitMethodInsn(INVOKEVIRTUAL, this.interceptorManagerClassName, getterName, "()"
                        + encodeClassDesc(interceptor.getClassName()));
                mv.visitFieldInsn(PUTFIELD, this.generatedClassName, INTERCEPTOR + (index++), encodeClassDesc(interceptor
                        .getClassName()));
            }
        }

View Full Code Here

     */
    private void addInvocationContextGetTarget() {
        MethodVisitor mv = getCW().visitMethod(ACC_PUBLIC, "getTarget", "()Ljava/lang/Object;", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, this.generatedClassName, "bean", this.beanClassDesc);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }

View Full Code Here

     */
    private void addEasyBeansInvocationContextGetFactory() {
        MethodVisitor mv = getCW().visitMethod(ACC_PUBLIC, "getFactory", "()" + EASYBEANS_FACTORY, null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, this.generatedClassName, "factory", EASYBEANS_FACTORY);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();

    }
View Full Code Here

        // only for around invoke type, lifecycle interceptor should return null
        if (this.interceptorType == AROUND_INVOKE) {

            // if (method == null) {
            mv.visitFieldInsn(GETSTATIC, this.generatedClassName, "method", JAVA_LANG_REFLECT_METHOD);
            // go to this label if not null
            Label notNullParametersLabel = new Label();
            mv.visitJumpInsn(IFNONNULL, notNullParametersLabel);

View Full Code Here

            // signature of the getMethod() method on java.lang.Class class
            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class",
                    "getMethod", "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;");

            // set the result : method = ...
            mv.visitFieldInsn(PUTSTATIC, this.generatedClassName, "method", "Ljava/lang/reflect/Method;");


            // go to the return label
            mv.visitJumpInsn(GOTO, notNullParametersLabel);
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.