Package org.more.asm

Examples of org.more.asm.MethodVisitor


        //1.采集方法
        String findDesc = name + desc.substring(0, desc.lastIndexOf(")") + 1);
        this.validMethod.add(findDesc);
        //2.忽略构造方法,aop包装不会考虑构造方法。
        if (name.equals("<init>") == true) {
            MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
            mv.visitCode();
            this.visitConstruction(mv, name, desc);
            mv.visitEnd();
            return null;
        }
        return null;
    }
View Full Code Here


        return null;
    }
    public void visitEnd() {
        InnerPropertyDelegateDefine[] newPropertyList = this.classConfig.getNewPropertyList();
        for (InnerPropertyDelegateDefine property : newPropertyList) {
            MethodVisitor mv = null;
            String propertyName = property.propertyName();
            String $propertyName = StringUtils.firstCharToUpperCase(propertyName);
            String typeDesc = ASMEngineToos.toAsmType(property.getType());
            //
            if (property.isMarkRead()) {
                String methodName = "get" + $propertyName;
                String desc = String.format("()%s", typeDesc);
                String testDesc = methodName + "()";
                //检测是否存在同名方法
                if (this.validMethod.contains(testDesc) == false) {
                    mv = super.visitMethod(ACC_PUBLIC, methodName, desc, null, null);
                    mv.visitCode();
                    this.buildGetMethod(mv, propertyName, typeDesc);
                    mv.visitEnd();
                }
            }
            if (property.isMarkWrite()) {
                String methodName = "set" + $propertyName;
                String desc = String.format("(%s)V", typeDesc);
                String testDesc = String.format("%s(%s)", methodName, typeDesc);;
                //检测是否存在同名方法
                if (this.validMethod.contains(testDesc) == false) {
                    mv = super.visitMethod(ACC_PUBLIC, methodName, desc, null, null);
                    mv.visitCode();
                    this.buildSetMethod(mv, propertyName, typeDesc);
                    mv.visitEnd();
                }
            }
            //
        }
        super.visitEnd();
View Full Code Here

            //
            if (ASMEngineToos.checkIn(access, Modifier.NATIVE)) {
                access = access - Modifier.NATIVE;
            }
            //
            MethodVisitor mv = this.visitMethod(access, name, desc, signature, exceptions);
            mv.visitCode();
            this.visitProxyMethod(mv, name, desc);//输出新方法。
            mv.visitEnd();
        }
        //3.输出“$aopFun”方法
        for (Method targetMethod : this.aopMethodMap) {
            int access = Modifier.PRIVATE;
            String name = targetMethod.getName();
            String desc = ASMEngineToos.toAsmDesc(targetMethod);
            String signature = ASMEngineToos.toAsmSignature(targetMethod);
            Class<?>[] errors = targetMethod.getExceptionTypes();
            String[] exceptions = new String[errors.length];
            for (int i = 0; i < errors.length; i++) {
                exceptions[i] = ASMEngineToos.replaceClassName(errors[i]);
            }
            //
            MethodVisitor mv = this.visitMethod(access, AopPrefix + name, desc, signature, exceptions);
            mv.visitCode();
            this.visitAOPMethod(mv, name, desc);//输出新方法。
            mv.visitEnd();
        }
        //4.采集类本身的方法。
        Method[] methodSet2 = this.classConfig.getSuperClass().getDeclaredMethods();
        for (Method targetMethod : methodSet2) {
            String selfMethodDesc = ASMEngineToos.toAsmFullDesc(targetMethod);
View Full Code Here

        String asmReturns = m.group(2);
        asmReturns = asmReturns.charAt(0) == 'L' ? asmReturns.substring(1, asmReturns.length() - 1) : asmReturns;
        //
        //2.忽略构造方法,aop包装不会考虑构造方法。
        if (name.equals("<init>") == true) {
            MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
            mv.visitCode();
            this.visitConstruction(mv, name, desc);
            mv.visitEnd();
            return null;
        }
        //2.兼容如果有其它ClassVisitor动态输出方法时不会影响到它。
        String testFullDesc = name + desc;
        if (this.validMethod.contains(testFullDesc) == false) {
View Full Code Here

        //1.采集方法
        String findDesc = name + desc.substring(0, desc.lastIndexOf(")") + 1);
        this.validMethod.add(findDesc);
        //2.忽略构造方法,aop包装不会考虑构造方法。
        if (name.equals("<init>") == true) {
            MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
            mv.visitCode();
            this.visitConstruction(mv, name, desc);
            mv.visitEnd();
            return null;
        }
        return null;
    }
View Full Code Here

                String mName = tMethod.getName();
                String typeDesc = String.format("%s(%s)", mName, ASMEngineToos.toAsmType(tMethod.getParameterTypes()));
                //
                if (this.validMethod.contains(typeDesc) == false) {
                    String desc = ASMEngineToos.toAsmDesc(tMethod);
                    MethodVisitor mv = super.visitMethod(ACC_PUBLIC, mName, desc, null, null);
                    mv.visitCode();
                    this.buildInterfaceMethod(mv, mName, desc, faceType);
                    mv.visitEnd();
                }
                //
            }
            //
        }
View Full Code Here

TOP

Related Classes of org.more.asm.MethodVisitor

Copyright © 2018 www.massapicom. 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.