Package org.ow2.asm

Examples of org.ow2.asm.ClassWriter.visit()


        ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
        FieldVisitor fv;
        MethodVisitor mv;

        cw.visit( ClassGenerator.JAVA_VERSION, ACC_PUBLIC + ACC_SUPER,
                BuildUtils.getInternalType( wrapperName ),
                BuildUtils.getTypeDescriptor( coreName ) +
                        "Lorg/drools/factmodel/traits/CoreWrapper<" + BuildUtils.getTypeDescriptor( coreName ) + ">;",
                BuildUtils.getInternalType( coreName ),
                new String[] { Type.getInternalName( CoreWrapper.class ), Type.getInternalName( Externalizable.class ) } );
View Full Code Here


                intfaces[ tmp.length ] = BuildUtils.getInternalType( classDef.getSuperClass() );
                intfaces[ tmp.length + 1 ] = Type.getInternalName( Serializable.class );
                intfaces[ tmp.length + 2 ] = Type.getInternalName( GeneratedFact.class );
            }

            cw.visit( ClassGenerator.JAVA_VERSION, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE,
                    cName,
                    genericTypes,
                    superType,
                    intfaces );
View Full Code Here

    }

    public byte[] generateBytecode() {
        if (bytecode == null) {
            ClassWriter cw = new InternalClassWriter(classLoader, ClassWriter.COMPUTE_MAXS);
            cw.visit(JAVA_VERSION, access, getClassDescriptor(), signature, getSuperClassDescriptor(), toInteralNames(interfaces));
            for (int i = 0; i < classParts.size(); i++) { // don't use iterator to allow method visits to add more class fields and methods
                classParts.get(i).write(this, cw);
            }
            if (staticInitializer != null) {
                staticInitializer.write(this, cw);
View Full Code Here

                System.arraycopy( tmp, 0, intfaces, 0, tmp.length );
                intfaces[ tmp.length ] = BuildUtils.getInternalType( classDef.getSuperClass() );
                intfaces[ tmp.length +1 ] = "java/io/Serializable";
            }

            cw.visit(V1_5, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE,
                    cName,
                    genericTypes,
                    superType,
                    intfaces );
View Full Code Here

            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        cw.visit( V1_5,
                  ACC_PUBLIC + ACC_SUPER,
                  internalProxy,
                  null,
                  "org/drools/factmodel/traits/TraitProxy",
                  new String[] { internalTrait, "java/io/Externalizable" } );
View Full Code Here

        ClassWriter cw = new ClassWriter(0);
        FieldVisitor fv;
        MethodVisitor mv;

        cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER,
                BuildUtils.getInternalType(wrapperName),
                BuildUtils.getTypeDescriptor( coreName) +
                        "Lorg/drools/factmodel/traits/CoreWrapper<" + BuildUtils.getTypeDescriptor( coreName ) + ">;",
                BuildUtils.getInternalType( coreName ),
                new String[]{"org/drools/factmodel/traits/CoreWrapper", "java/io/Externalizable" });
View Full Code Here

        }
    }

    public static ClassWriter createClassWriter(ClassLoader classLoader, int access, String name, String signature, String superName, String[] interfaces) {
        ClassWriter cw = new InternalClassWriter(classLoader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES );
        cw.visit(ClassLevel.getJavaVersion(classLoader), access, name, signature, superName, interfaces);
        return cw;
    }
}
View Full Code Here

        }
    }

    public static ClassWriter createClassWriter(ClassLoader classLoader, int access, String name, String signature, String superName, String[] interfaces) {
        ClassWriter cw = new InternalClassWriter(classLoader, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES );
        cw.visit(ClassLevel.getJavaVersion(classLoader), access, name, signature, superName, interfaces);
        return cw;
    }
}
View Full Code Here

        String descrCore        = Type.getDescriptor( core.getDefinedClass() );
        String internalCore     = Type.getInternalName( core.getDefinedClass() );


       
        cw.visit( V1_5, ACC_PUBLIC + ACC_SUPER,
                internalWrapper,
                Type.getDescriptor( Object.class ) + Type.getDescriptor( Map.class ) + Type.getDescriptor( MapWrapper.class ),
//                "Ljava/lang/Object;Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;Lorg/drools/factmodel/traits/MapWrapper;",
                Type.getInternalName( Object.class ),
                new String[]{ Type.getInternalName( Map.class ), Type.getInternalName( MapWrapper.class ), Type.getInternalName( Serializable.class ) } );
View Full Code Here

                System.arraycopy( tmp, 0, intfaces, 0, tmp.length );
                intfaces[ tmp.length ] = BuildUtils.getInternalType( classDef.getSuperClass() );
                intfaces[ tmp.length + 1 ] = Type.getInternalName( Serializable.class );
            }

            cw.visit( V1_5, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE,
                    cName,
                    genericTypes,
                    superType,
                    intfaces );
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.