1 16 package net.sf.cglib.proxy; 17 18 import java.util.*; 19 import net.sf.cglib.core.*; 20 import org.objectweb.asm.Type; 21 22 class FixedValueGenerator implements CallbackGenerator { 23 public static final FixedValueGenerator INSTANCE = new FixedValueGenerator(); 24 private static final Type FIXED_VALUE = 25 TypeUtils.parseType("net.sf.cglib.proxy.FixedValue"); 26 private static final Signature LOAD_OBJECT = 27 TypeUtils.parseSignature("Object loadObject()"); 28 29 public void generate(ClassEmitter ce, 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(); 37 e.end_method(); 38 } 39 } 40 41 public void generateStatic(CodeEmitter e, Context context, List methods) { } 42 } 43 | Popular Tags |