Package net.sf.cglib.core

Examples of net.sf.cglib.core.MethodInfo


        for (Iterator iterator = methods.iterator(); iterator
        .hasNext();) {
          Method method = (Method) iterator.next();

          if (Modifier.isAbstract(method.getModifiers())) {
            MethodInfo methodInfo = ReflectUtils.getMethodInfo(method);
            Signature signature = methodInfo.getSignature();
            Type returnType = signature.getReturnType();

            CodeEmitter e = ce.begin_method(method.getModifiers() & ~Modifier.ABSTRACT,
                signature, methodInfo.getExceptionTypes(),
                methodInfo.getAttribute());

            e.zero_or_null(returnType);
            e.return_value();

            Type[] argumentTypes = methodInfo.getSignature().getArgumentTypes();
            int size = 0;
            if (argumentTypes != null) {
              for (int i = 0; i < argumentTypes.length; i++) {
                size += argumentTypes[i].getSize();
              }
View Full Code Here


          for (Iterator iterator = methods.iterator(); iterator
          .hasNext();) {
            Method method = (Method) iterator.next();

            if (Modifier.isAbstract(method.getModifiers())) {
              MethodInfo methodInfo = ReflectUtils.getMethodInfo(method);
              Signature signature = methodInfo.getSignature();
              Type returnType = signature.getReturnType();

              CodeEmitter e = ce.begin_method(method.getModifiers() & ~Modifier.ABSTRACT,
                  signature, methodInfo.getExceptionTypes(),
                  methodInfo.getAttribute());

              e.zero_or_null(returnType);
              e.return_value();

              Type[] argumentTypes = methodInfo.getSignature().getArgumentTypes();
              int size = 0;
              if (argumentTypes != null) {
                for (int i = 0; i < argumentTypes.length; i++) {
                  size += argumentTypes[i].getSize();
                }
View Full Code Here

/*     */       }
/* 128 */       for (int i = 0; i < setters.length; i++) {
/* 129 */         PropertyDescriptor setter = setters[i];
/* 130 */         PropertyDescriptor getter = (PropertyDescriptor)names.get(setter.getName());
/* 131 */         if (getter != null) {
/* 132 */           MethodInfo read = ReflectUtils.getMethodInfo(getter.getReadMethod());
/* 133 */           MethodInfo write = ReflectUtils.getMethodInfo(setter.getWriteMethod());
/* 134 */           if (this.useConverter) {
/* 135 */             Type setterType = write.getSignature().getArgumentTypes()[0];
/* 136 */             e.load_local(targetLocal);
/* 137 */             e.load_arg(2);
/* 138 */             e.load_local(sourceLocal);
/* 139 */             e.invoke(read);
/* 140 */             e.box(read.getSignature().getReturnType());
/* 141 */             EmitUtils.load_class(e, setterType);
/* 142 */             e.push(write.getSignature().getName());
/* 143 */             e.invoke_interface(BeanCopier.CONVERTER, BeanCopier.CONVERT);
/* 144 */             e.unbox_or_zero(setterType);
/* 145 */             e.invoke(write);
/* 146 */           } else if (compatible(getter, setter)) {
/* 147 */             e.dup2();
View Full Code Here

/*  61 */       e.checkcast(Type.getType(target));
/*  62 */       Local bean = e.make_local();
/*  63 */       e.store_local(bean);
/*  64 */       for (int i = 0; i < getters.length; i++) {
/*  65 */         if (getters[i] != null) {
/*  66 */           MethodInfo getter = ReflectUtils.getMethodInfo(getters[i]);
/*  67 */           e.load_arg(1);
/*  68 */           e.push(i);
/*  69 */           e.load_local(bean);
/*  70 */           e.invoke(getter);
/*  71 */           e.box(getter.getSignature().getReturnType());
/*  72 */           e.aastore();
/*     */         }
/*     */       }
/*     */     }
/*  76 */     e.return_value();
View Full Code Here

/*  89 */       e.load_arg(1);
/*  90 */       Block handler = e.begin_block();
/*  91 */       int lastIndex = 0;
/*  92 */       for (int i = 0; i < setters.length; i++) {
/*  93 */         if (setters[i] != null) {
/*  94 */           MethodInfo setter = ReflectUtils.getMethodInfo(setters[i]);
/*  95 */           int diff = i - lastIndex;
/*  96 */           if (diff > 0) {
/*  97 */             e.iinc(index, diff);
/*  98 */             lastIndex = i;
/*     */           }
/* 100 */           e.dup2();
/* 101 */           e.aaload(i);
/* 102 */           e.unbox(setter.getSignature().getArgumentTypes()[0]);
/* 103 */           e.invoke(setter);
/*     */         }
/*     */       }
/* 106 */       handler.end();
/* 107 */       e.return_value();
View Full Code Here

/*    */
/*    */   public void generate(ClassEmitter ce, CallbackGenerator.Context context, List methods)
/*    */   {
/* 32 */     Set indexes = new HashSet();
/* 33 */     for (Iterator it = methods.iterator(); it.hasNext(); ) {
/* 34 */       MethodInfo method = (MethodInfo)it.next();
/* 35 */       if (!TypeUtils.isProtected(method.getModifiers()))
/*    */       {
/* 38 */         int index = context.getIndex(method);
/* 39 */         indexes.add(new Integer(index));
/* 40 */         CodeEmitter e = context.beginMethod(ce, method);
/* 41 */         e.load_this();
/* 42 */         e.dup();
/* 43 */         e.invoke_virtual_this(loadMethod(index));
/* 44 */         e.checkcast(method.getClassInfo().getType());
/* 45 */         e.load_args();
/* 46 */         e.invoke(method);
/* 47 */         e.return_value();
/* 48 */         e.end_method();
/*    */       }
View Full Code Here

/*    */ {
/* 25 */   public static final NoOpGenerator INSTANCE = new NoOpGenerator();
/*    */
/*    */   public void generate(ClassEmitter ce, CallbackGenerator.Context context, List methods) {
/* 28 */     for (Iterator it = methods.iterator(); it.hasNext(); ) {
/* 29 */       MethodInfo method = (MethodInfo)it.next();
/* 30 */       if ((TypeUtils.isProtected(context.getOriginalModifiers(method))) && (TypeUtils.isPublic(method.getModifiers())))
/*    */       {
/* 32 */         CodeEmitter e = EmitUtils.begin_method(ce, method);
/* 33 */         e.load_this();
/* 34 */         e.load_args();
/* 35 */         e.super_invoke();
View Full Code Here

/* 33 */   private static final Signature INVOKE = TypeUtils.parseSignature("Object invoke(Object, java.lang.reflect.Method, Object[])");
/*    */
/*    */   public void generate(ClassEmitter ce, CallbackGenerator.Context context, List methods)
/*    */   {
/* 37 */     for (Iterator it = methods.iterator(); it.hasNext(); ) {
/* 38 */       MethodInfo method = (MethodInfo)it.next();
/* 39 */       Signature impl = context.getImplSignature(method);
/* 40 */       ce.declare_field(26, impl.getName(), METHOD, null, null);
/*    */
/* 42 */       CodeEmitter e = context.beginMethod(ce, method);
/* 43 */       Block handler = e.begin_block();
/* 44 */       context.emitCallback(e, context.getIndex(method));
/* 45 */       e.load_this();
/* 46 */       e.getfield(impl.getName());
/* 47 */       e.create_arg_array();
/* 48 */       e.invoke_interface(INVOCATION_HANDLER, INVOKE);
/* 49 */       e.unbox(method.getSignature().getReturnType());
/* 50 */       e.return_value();
/* 51 */       handler.end();
/* 52 */       EmitUtils.wrap_undeclared_throwable(e, handler, method.getExceptionTypes(), UNDECLARED_THROWABLE_EXCEPTION);
/* 53 */       e.end_method();
/*    */     }
/*    */   }
View Full Code Here

/*    */     }
/*    */   }
/*    */
/*    */   public void generateStatic(CodeEmitter e, CallbackGenerator.Context context, List methods) {
/* 58 */     for (Iterator it = methods.iterator(); it.hasNext(); ) {
/* 59 */       MethodInfo method = (MethodInfo)it.next();
/* 60 */       EmitUtils.load_method(e, method);
/* 61 */       e.putfield(context.getImplSignature(method).getName());
/*    */     }
/*    */   }
View Full Code Here

/* 26 */   private static final Signature LOAD_OBJECT = TypeUtils.parseSignature("Object loadObject()");
/*    */
/*    */   public void generate(ClassEmitter ce, CallbackGenerator.Context context, List methods)
/*    */   {
/* 30 */     for (Iterator it = methods.iterator(); it.hasNext(); ) {
/* 31 */       MethodInfo method = (MethodInfo)it.next();
/* 32 */       CodeEmitter e = context.beginMethod(ce, method);
/* 33 */       context.emitCallback(e, context.getIndex(method));
/* 34 */       e.invoke_interface(FIXED_VALUE, LOAD_OBJECT);
/* 35 */       e.unbox_or_zero(e.getReturnType());
/* 36 */       e.return_value();
View Full Code Here

TOP

Related Classes of net.sf.cglib.core.MethodInfo

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.