Package cn.wensiqun.asmsupport.entity

Examples of cn.wensiqun.asmsupport.entity.MethodEntity


            AClass[] exceptionArray = new AClass[exceptions.length];
            for(int i=0; i<exceptions.length; i++){
              exceptionArray[i] = AClassFactory.getProductClass(forName(exceptions[i]));
            }
           
            MethodEntity me = new MethodEntity(
                  name, owner, owner, aclass, args, returnType, exceptionArray, access);
           
            list.add(me);
          } catch (ClassNotFoundException e) {
            e.printStackTrace();
View Full Code Here


                }
            }
           
            AClass[] pcs;
            boolean sameToPass = true;
            MethodEntity me;
            for (; actuallyMethodOwner != null; ) {
                try {
                  AClass methodReturnType = null;
                  int methodMidifiers;
                  AClass[] exceptionTypes;
                 
                  if(name.equals(ASConstant.INIT)){
                        Constructor<?> constructor = actuallyMethodOwner.getDeclaredConstructor(argclses);
                        methodMidifiers = constructor.getModifiers();
                        exceptionTypes = convertToAClass(constructor.getExceptionTypes());
                  }else{
                        Method method = actuallyMethodOwner.getDeclaredMethod(name, argclses);
                        methodReturnType = AClassFactory.getProductClass(method.getReturnType());
                        methodMidifiers = method.getModifiers();
                        exceptionTypes = convertToAClass(method.getExceptionTypes());
                  }
                   
                    if(AClassUtils.visible(invoker, invoked, AClassFactory.getProductClass(actuallyMethodOwner),
                        methodMidifiers)){
                        pcs = new AClass[ttns.length];
                        for(int i=0; i<ttns.length; i++){
                            pcs[i] = ttns[i].type;
                            if(!pcs[i].equals(orgiArguTypes[i])){
                                sameToPass = false;
                            }
                        }
                        me = new MethodEntity(name, AClassFactory.getProductClass(javaClass),
                                AClassFactory.getProductClass(actuallyMethodOwner), pcs,
                                arguNames, methodReturnType, exceptionTypes, methodMidifiers);
                       
                        mes.add(me);
                       
View Full Code Here

        if(cls.isPrimitive()){
            throw new ASMSupportException("cannot invoke method in prmitive");
        }
       
        Class<?> actually = cls;
        MethodEntity me;
       
        for(; actually != null ;){
            try {
              AClass methodReturnType = null;
              int methodMidifiers;
              AClass[] exceptionTypes;
             
              if(name.equals(ASConstant.INIT)){
                    Constructor<?> constructor = actually.getDeclaredConstructor();
                    methodMidifiers = constructor.getModifiers();
                    exceptionTypes = convertToAClass(constructor.getExceptionTypes());
              }else{
                    Method method = actually.getDeclaredMethod(name);
                    methodReturnType = AClassFactory.getProductClass(method.getReturnType());
                    methodMidifiers = method.getModifiers();
                    exceptionTypes = convertToAClass(method.getExceptionTypes());
              }
             
                AClass invoked =  AClassFactory.getProductClass(cls);
                AClass actuallyInvoked = AClassFactory.getProductClass(actually);
               
                if(!AClassUtils.visible(invoker, invoked, actuallyInvoked, methodMidifiers)){
                    throw new ASMSupportException("cannot invoke method by the modifiers " + Modifier.toString(methodMidifiers));
                }
               
                me = new MethodEntity(name,invoked, actuallyInvoked,
                        null, null, methodReturnType, exceptionTypes, methodMidifiers);
               
                return me;
            } catch (SecurityException e) {
            } catch (NoSuchMethodException e) {
View Full Code Here

    public MethodEntity chooseMethod() {
        if(this.argumentTypes == null || this.argumentTypes.length == 0){
            return foundMethodWithNoArguments();
        }
       
        MethodEntity me = firstPhase();
        if(me != null){
            return me;
        }
       
        me = secondPhase();
View Full Code Here

    this.superConstructorOperators = superConstructorOperators;
  }

  @Override
    public void generateBody() {
    MethodEntity me = method.getMethodEntity();
    if(me.getName().equals(ASConstant.INIT)){
      //如果是构造方法,将被修改的构造方法中调用父类构造方法的那段字节码转移到新的构造方法中。
      if(superConstructorOperators != null){
          for(VisitXInsnAdapter visitXInsnAdapter : superConstructorOperators){
            visitXInsnAdapter.newVisitXInsnOperator(getExecuteBlock());
          }
View Full Code Here

TOP

Related Classes of cn.wensiqun.asmsupport.entity.MethodEntity

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.