Package org.mvel2.asm

Examples of org.mvel2.asm.MethodVisitor.visitCode()


            }
        }
        if ( coreKlazz == null || needsMethod( coreKlazz, "getTraits" ) ) {
            {
                mv = cw.visitMethod( ACC_PUBLIC, "getTraits", "()" + Type.getDescriptor( Collection.class ), "()Ljava/util/Collection<Ljava/lang/String;>;", null );
                mv.visitCode();
                mv.visitVarInsn( ALOAD, 0 );
                mv.visitMethodInsn( INVOKEVIRTUAL, BuildUtils.getInternalType( wrapperName ), "_getTraitMap", "()" + Type.getDescriptor( Map.class ) );
                mv.visitMethodInsn( INVOKEINTERFACE, Type.getInternalName( Map.class ), "keySet", "()" + Type.getDescriptor( Set.class ) );
                mv.visitInsn( ARETURN );
                mv.visitMaxs( 0, 0 );
View Full Code Here


            }
        }
        if ( coreKlazz == null || needsMethod( coreKlazz, "_setBottomTypeCode" ) ) {
            {
                mv = cw.visitMethod( ACC_PUBLIC, "_setBottomTypeCode", "(" + Type.getDescriptor( BitSet.class )+ ")V", null, null );
                mv.visitCode();
                mv.visitVarInsn( ALOAD, 0 );
                mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType( wrapperName ), TraitableBean.TRAITSET_FIELD_NAME , Type.getDescriptor( Map.class ) );
                mv.visitTypeInsn( CHECKCAST, Type.getInternalName( TraitTypeMap.class ) );
                mv.visitVarInsn( ALOAD, 1 );
                mv.visitMethodInsn( INVOKEVIRTUAL, Type.getInternalName( TraitTypeMap.class ), "setBottomCode", "(" + Type.getDescriptor( BitSet.class ) + ")V");
View Full Code Here

        if ( coreKlazz == null || needsMethod( coreKlazz, "getCurrentTypeCode" ) ) {

            {
                mv = cw.visitMethod( ACC_PUBLIC, "getCurrentTypeCode", "()" + Type.getDescriptor( BitSet.class ), null, null );
                mv.visitCode();

                mv.visitVarInsn( ALOAD, 0 );
                mv.visitFieldInsn( GETFIELD,
                                   BuildUtils.getInternalType( wrapperName ),
                                   TraitableBean.TRAITSET_FIELD_NAME,
View Full Code Here

                mv = cw.visitMethod( ACC_PUBLIC,
                        "getMostSpecificTraits",
                        "()" + Type.getDescriptor( Collection.class ),
                        "()Ljava/util/Collection<Lorg/drools/factmodel/traits/Thing;>;",
                        null );
                mv.visitCode();
                mv.visitVarInsn( ALOAD, 0 );
                mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType( wrapperName ),
                        TraitableBean.TRAITSET_FIELD_NAME ,
                        Type.getDescriptor( Map.class ) );
                mv.visitTypeInsn( CHECKCAST, Type.getInternalName( TraitTypeMap.class ) );
View Full Code Here

                mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
                                     "_getFieldTMS",
                                     Type.getMethodDescriptor( Type.getType( TraitFieldTMS.class ), new Type[] {} ),
                                     null,
                                     null);
                mv.visitCode();
                mv.visitVarInsn( ALOAD, 0 );
                mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType( wrapperName ), TraitableBean.FIELDTMS_FIELD_NAME, Type.getDescriptor( TraitFieldTMS.class ) );
                mv.visitInsn( ARETURN );
                mv.visitMaxs( 0, 0 );
                mv.visitEnd();
View Full Code Here

                mv = cw.visitMethod( ACC_PUBLIC,
                                     "_setFieldTMS",
                                     Type.getMethodDescriptor( Type.VOID_TYPE, new Type[] { Type.getType( TraitFieldTMS.class ) } ),
                                     null,
                                     null);
                mv.visitCode();
                mv.visitVarInsn( ALOAD, 0 );
                mv.visitVarInsn( ALOAD, 1 );
                mv.visitFieldInsn ( PUTFIELD, BuildUtils.getInternalType( wrapperName ), TraitableBean.FIELDTMS_FIELD_NAME, Type.getDescriptor( TraitFieldTMS.class ) );
                mv.visitInsn( RETURN) ;
                mv.visitMaxs( 0, 0 );
View Full Code Here



        {
            mv = cw.visitMethod( ACC_PUBLIC, "writeExternal", "(" + Type.getDescriptor( ObjectOutput.class ) + ")V", null, new String[] { Type.getInternalName( IOException.class ) } );
            mv.visitCode();

            mv.visitVarInsn( ALOAD, 1 );
            mv.visitVarInsn( ALOAD, 0 );
            mv.visitMethodInsn( INVOKEVIRTUAL, BuildUtils.getInternalType( wrapperName ), "getCore", "()" + Type.getDescriptor( Object.class ) );
            mv.visitMethodInsn( INVOKEINTERFACE, Type.getInternalName( ObjectOutput.class ), "writeObject", "(" + Type.getDescriptor( Object.class ) + ")V" );
View Full Code Here

            mv.visitEnd();
        }
        {
            mv = cw.visitMethod( ACC_PUBLIC, "readExternal", "(" + Type.getDescriptor( ObjectInput.class ) + ")V", null,
                    new String[] { Type.getInternalName( IOException.class ), Type.getInternalName( ClassNotFoundException.class ) } );
            mv.visitCode();

            mv.visitVarInsn( ALOAD, 0 );
            mv.visitVarInsn( ALOAD, 1 );
            mv.visitMethodInsn( INVOKEINTERFACE, Type.getInternalName( ObjectInput.class ), "readObject", "()" + Type.getDescriptor( Object.class ) );
            mv.visitTypeInsn( CHECKCAST, BuildUtils.getInternalType( coreName ) );
View Full Code Here

            this.body = body;
        }

        public void write(ClassGenerator cg, ClassWriter cw) {
            MethodVisitor mv = cw.visitMethod(access, name, desc, signature, exceptions);
            mv.visitCode();

            try {
                body.writeBody(cg, mv);
                mv.visitMaxs(0, 0);
            } catch (Exception e) {
View Full Code Here

        private final List<MethodBody> initializerBodies = new ArrayList<MethodBody>();

        public void write(ClassGenerator cg, ClassWriter cw) {
            MethodVisitor mv = cw.visitMethod(ACC_STATIC, "<clinit>", "()V", null, null);
            mv.visitCode();

            try {
                for (MethodBody initializerBody : initializerBodies) {
                    initializerBody.writeBody(cg, mv);
                }
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.