Package org.ow2.easybeans.asm

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


            // if
            mv.visitVarInsn(ALOAD, 0);
            mv.visitTypeInsn(NEW, "java/util/HashMap");
            mv.visitInsn(DUP);
            mv.visitMethodInsn(INVOKESPECIAL, "java/util/HashMap", "<init>", "()V");
            mv.visitFieldInsn(PUTFIELD, this.generatedClassName, "contextData", "Ljava/util/Map;");

            // else
            mv.visitLabel(elseLabel);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.generatedClassName, "contextData", "Ljava/util/Map;");
View Full Code Here


            mv.visitFieldInsn(PUTFIELD, this.generatedClassName, "contextData", "Ljava/util/Map;");

            // else
            mv.visitLabel(elseLabel);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.generatedClassName, "contextData", "Ljava/util/Map;");

            // return
            mv.visitInsn(ARETURN);

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

        // only for around invoke type
        if (this.interceptorType == AROUND_INVOKE) {

            // if (parameters == null) {
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.generatedClassName, "parameters", ARRAY_OBJECTS);
            // go to this label if not null
            Label notNullParametersLabel = new Label();
            mv.visitJumpInsn(IFNONNULL, notNullParametersLabel);

            // parameters = new Object[] {arg0, arg1, arg...};
View Full Code Here

            int argCount = 0;
            for (Type type : this.methodArgsType) {
                mv.visitInsn(DUP);
                mv.visitIntInsn(BIPUSH, argCount);
                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, this.generatedClassName, ARG + argCount, type.getDescriptor());
                // if type is not object type, need to convert it
                // for example : Integer.valueOf(i);
                transformPrimitiveIntoObject(type, mv);
                mv.visitInsn(AASTORE);
                argCount++;
View Full Code Here

                mv.visitInsn(AASTORE);
                argCount++;
            }

            // store field
            mv.visitFieldInsn(PUTFIELD, this.generatedClassName, "parameters", ARRAY_OBJECTS);

            // not null label :
            // return parameters;
            mv.visitLabel(notNullParametersLabel);
            mv.visitVarInsn(ALOAD, 0);
View Full Code Here

            // not null label :
            // return parameters;
            mv.visitLabel(notNullParametersLabel);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.generatedClassName, "parameters", ARRAY_OBJECTS);
        } else {
            // throw Exception
            mv.visitTypeInsn(NEW, "java/lang/IllegalStateException");
            mv.visitInsn(DUP);
            mv.visitLdcInsn("Operation getParameters can only be applied on AroundInvoke interceptors");
View Full Code Here

            mv.visitLabel(sizeOk);

            // this.parameters = parameters
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 1);
            mv.visitFieldInsn(PUTFIELD, this.generatedClassName, "parameters", ARRAY_OBJECTS);

            /**
             * arg0 = (Integer) aobj[0]; arg1 = ((Integer) aobj[1]).intValue();
             * arg2 = ((Double) aobj[2]).doubleValue(); arg3 = ((Float)
             * aobj[3]).floatValue(); arg4 = (String) aobj[4]; ...
View Full Code Here

                mv.visitIntInsn(BIPUSH, argCount);
                mv.visitInsn(AALOAD);
                // Cast object Integer.valueOf(i);
                transformObjectIntoPrimitive(type, mv);
                // write result
                mv.visitFieldInsn(PUTFIELD, this.generatedClassName, ARG + argCount, type.getDescriptor());
                argCount++;
            }
        } else {
            // throw Exception
            mv.visitTypeInsn(NEW, "java/lang/IllegalStateException");
View Full Code Here

        MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, getterName, "()" + className, null, null);
        // Add some flags on the generated method
        addAnnotationsOnGeneratedMethod(mv);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, beanClassName, fieldName, className);
        // return type is depending of the type
        addReturnType(type, mv);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
View Full Code Here

        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        // Depends of the type
        int opCode = putFieldLoadOpCode(type.getSort());
        mv.visitVarInsn(opCode, 1);
        mv.visitFieldInsn(PUTFIELD, beanClassName, fieldName, className);
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }
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.