Package net.sf.cglib.asm

Examples of net.sf.cglib.asm.Type


/* 153 */     CodeEmitter e = super.begin_method(1, PROVIDER_GET_BY_INDEX, null, null);
/* 154 */     e.load_this();
/* 155 */     e.load_arg(0);
/* 156 */     e.process_switch(indexes, new ProcessSwitchCallback(names, e) {
/*     */       public void processCase(int key, Label end) throws Exception {
/* 158 */         Type type = (Type)FieldProviderTransformer.this.fields.get(this.val$names[key]);
/* 159 */         this.val$e.getfield(this.val$names[key]);
/* 160 */         this.val$e.box(type);
/* 161 */         this.val$e.return_value();
/*     */       }
/*     */       public void processDefault() throws Exception {
View Full Code Here


/* 173 */     CodeEmitter e = begin_method(1, PROVIDER_GET, null, null);
/* 174 */     e.load_this();
/* 175 */     e.load_arg(0);
/* 176 */     EmitUtils.string_switch(e, names, 1, new ObjectSwitchCallback(e) {
/*     */       public void processCase(Object key, Label end) {
/* 178 */         Type type = (Type)FieldProviderTransformer.this.fields.get(key);
/* 179 */         this.val$e.getfield((String)key);
/* 180 */         this.val$e.box(type);
/* 181 */         this.val$e.return_value();
/*     */       }
/*     */       public void processDefault() {
View Full Code Here

/* 192 */     e.load_this();
/* 193 */     e.load_arg(1);
/* 194 */     e.load_arg(0);
/* 195 */     EmitUtils.string_switch(e, names, 1, new ObjectSwitchCallback(e) {
/*     */       public void processCase(Object key, Label end) {
/* 197 */         Type type = (Type)FieldProviderTransformer.this.fields.get(key);
/* 198 */         this.val$e.unbox(type);
/* 199 */         this.val$e.putfield((String)key);
/* 200 */         this.val$e.return_value();
/*     */       }
/*     */       public void processDefault() {
View Full Code Here

/*  89 */       Object key = BeanCopier.KEY_FACTORY.newInstance(this.source.getName(), this.target.getName(), this.useConverter);
/*  90 */       return (BeanCopier)super.create(key);
/*     */     }
/*     */
/*     */     public void generateClass(ClassVisitor v) {
/*  94 */       Type sourceType = Type.getType(this.source);
/*  95 */       Type targetType = Type.getType(this.target);
/*  96 */       ClassEmitter ce = new ClassEmitter(v);
/*  97 */       ce.begin_class(46, 1, getClassName(), BeanCopier.BEAN_COPIER, null, "<generated>");
/*     */
/* 104 */       EmitUtils.null_constructor(ce);
/* 105 */       CodeEmitter e = ce.begin_method(1, BeanCopier.COPY, null, null);
/* 106 */       PropertyDescriptor[] getters = ReflectUtils.getBeanGetters(this.source);
/* 107 */       PropertyDescriptor[] setters = ReflectUtils.getBeanGetters(this.target);
/*     */
/* 109 */       Map names = new HashMap();
/* 110 */       for (int i = 0; i < getters.length; i++) {
/* 111 */         names.put(getters[i].getName(), getters[i]);
/*     */       }
/* 113 */       Local targetLocal = e.make_local();
/* 114 */       Local sourceLocal = e.make_local();
/* 115 */       if (this.useConverter) {
/* 116 */         e.load_arg(1);
/* 117 */         e.checkcast(targetType);
/* 118 */         e.store_local(targetLocal);
/* 119 */         e.load_arg(0);
/* 120 */         e.checkcast(sourceType);
/* 121 */         e.store_local(sourceLocal);
/*     */       } else {
/* 123 */         e.load_arg(1);
/* 124 */         e.checkcast(targetType);
/* 125 */         e.load_arg(0);
/* 126 */         e.checkcast(sourceType);
/*     */       }
/* 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());
View Full Code Here

/*  91 */     e.end_method();
/*     */   }
/*     */
/*     */   public static void process_array(CodeEmitter e, Type type, ProcessArrayCallback callback)
/*     */   {
/* 102 */     Type componentType = TypeUtils.getComponentType(type);
/* 103 */     Local array = e.make_local();
/* 104 */     Local loopvar = e.make_local(Type.INT_TYPE);
/* 105 */     Label loopbody = e.make_label();
/* 106 */     Label checkloop = e.make_label();
/* 107 */     e.store_local(array);
View Full Code Here

/* 123 */     e.if_icmp(155, loopbody);
/*     */   }
/*     */
/*     */   public static void process_arrays(CodeEmitter e, Type type, ProcessArrayCallback callback)
/*     */   {
/* 134 */     Type componentType = TypeUtils.getComponentType(type);
/* 135 */     Local array1 = e.make_local();
/* 136 */     Local array2 = e.make_local();
/* 137 */     Local loopvar = e.make_local(Type.INT_TYPE);
/* 138 */     Label loopbody = e.make_label();
/* 139 */     Label checkloop = e.make_label();
View Full Code Here

/*  65 */       setNamePrefix(name);
/*  66 */       return super.create(name);
/*     */     }
/*     */
/*     */     public void generateClass(ClassVisitor v) {
/*  70 */       Type targetType = Type.getType(this.target);
/*  71 */       ClassEmitter ce = new ClassEmitter(v);
/*  72 */       ce.begin_class(46, 1, getClassName(), targetType, null, "<generated>");
/*     */
/*  79 */       ce.declare_field(18, "CGLIB$RWBean", targetType, null, null);
/*     */
View Full Code Here

/*     */   public ClassInfo getClassInfo() {
/*  58 */     return this.classInfo;
/*     */   }
/*     */
/*     */   public void begin_class(int version, int access, String className, Type superType, Type[] interfaces, String sourceFile) {
/*  62 */     Type classType = Type.getType("L" + className.replace('.', '/') + ";");
/*  63 */     this.classInfo = new ClassInfo(classType, superType, interfaces, access) {
/*     */       public Type getType() {
/*  65 */         return this.val$classType;
/*     */       }
/*     */       public Type getSuperType() {
View Full Code Here

/*     */       }
/*     */       Constructor constructor;
/*  89 */       ClassEmitter ce = new ClassEmitter(v);
/*  90 */       ce.begin_class(46, 1, getClassName(), CONSTRUCTOR_DELEGATE, new Type[] { Type.getType(this.iface) }, "<generated>");
/*     */
/*  96 */       Type declaring = Type.getType(constructor.getDeclaringClass());
/*  97 */       EmitUtils.null_constructor(ce);
/*  98 */       CodeEmitter e = ce.begin_method(1, ReflectUtils.getSignature(newInstance), ReflectUtils.getExceptionTypes(newInstance), null);
/*     */
/* 102 */       e.new_instance(declaring);
/* 103 */       e.dup();
View Full Code Here

/*     */   public static MethodInfo getMethodInfo(Member member) {
/* 421 */     return getMethodInfo(member, member.getModifiers());
/*     */   }
/*     */
/*     */   public static ClassInfo getClassInfo(Class clazz) {
/* 425 */     Type type = Type.getType(clazz);
/* 426 */     Type sc = clazz.getSuperclass() == null ? null : Type.getType(clazz.getSuperclass());
/* 427 */     return new ClassInfo(type, sc, clazz) {
/*     */       public Type getType() {
/* 429 */         return this.val$type;
/*     */       }
/*     */       public Type getSuperType() {
View Full Code Here

TOP

Related Classes of net.sf.cglib.asm.Type

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.