Public feed #377860

Untitled

public java v1 · immutable
Raw Edit
·published 2007-03-02 02:03 UTC
rendered paste body
   public void addAccessor(ClassGen clazz,String accessorName, Field field) {        Type type = field.getType();        ConstantPoolGen cpg = clazz.getConstantPool();        InstructionFactory factory = new InstructionFactory(clazz, cpg);        InstructionList list = new InstructionList();        MethodGen methodGen =                new MethodGen(Constants.ACC_PUBLIC, Type.STRING, Type.NO_ARGS,                        new String[]{}, accessorName, className, list, cpg);        list.append(InstructionFactory.createLoad(type, 0));        list.append(factory.createFieldAccess(className, field.getName(), type,                Constants.GETFIELD));        list.append(InstructionFactory.createReturn(Type.OBJECT));        methodGen.setMaxStack();        methodGen.setMaxLocals();        clazz.addMethod(methodGen.getMethod());    }