1 54 package org.logicalcobwebs.cglib.proxy; 55 56 import java.lang.reflect.Method ; 57 import java.lang.reflect.Modifier ; 58 import java.util.*; 59 import org.logicalcobwebs.cglib.core.*; 60 import org.logicalcobwebs.asm.Type; 61 62 class FixedValueGenerator implements CallbackGenerator { 63 public static final FixedValueGenerator INSTANCE = new FixedValueGenerator(); 64 private static final Type FIXED_VALUE = 65 TypeUtils.parseType("org.logicalcobwebs.cglib.proxy.FixedValue"); 66 private static final Signature LOAD_OBJECT = 67 TypeUtils.parseSignature("Object loadObject()"); 68 69 public void generate(ClassEmitter ce, final Context context) { 70 for (Iterator it = context.getMethods(); it.hasNext();) { 71 Method method = (Method )it.next(); 72 CodeEmitter e = ce.begin_method(context.getModifiers(method), 73 ReflectUtils.getSignature(method), 74 ReflectUtils.getExceptionTypes(method), 75 null); 76 context.emitCallback(e, context.getIndex(method)); 77 e.invoke_interface(FIXED_VALUE, LOAD_OBJECT); 78 e.unbox_or_zero(e.getReturnType()); 79 e.return_value(); 80 e.end_method(); 81 } 82 } 83 84 public void generateStatic(CodeEmitter e, Context context) { } 85 } 86 | Popular Tags |