1 16 19 20 package org.apache.xalan.xsltc.compiler.util; 21 22 import org.apache.bcel.generic.ALOAD; 23 import org.apache.bcel.generic.ASTORE; 24 import org.apache.bcel.generic.ClassGen; 25 import org.apache.bcel.generic.Instruction; 26 import org.apache.bcel.generic.InstructionList; 27 28 32 public final class AttributeSetMethodGenerator extends MethodGenerator { 33 private static final int DOM_INDEX = 1; 34 private static final int ITERATOR_INDEX = 2; 35 private static final int HANDLER_INDEX = 3; 36 37 private static final org.apache.bcel.generic.Type[] argTypes = 38 new org.apache.bcel.generic.Type[3]; 39 private static final String [] argNames = new String [3]; 40 41 static { 42 argTypes[0] = Util.getJCRefType(DOM_INTF_SIG); 43 argNames[0] = DOM_PNAME; 44 argTypes[1] = Util.getJCRefType(NODE_ITERATOR_SIG); 45 argNames[1] = ITERATOR_PNAME; 46 argTypes[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG); 47 argNames[2] = TRANSLET_OUTPUT_PNAME; 48 } 49 50 51 private final Instruction _aloadDom; 52 private final Instruction _astoreDom; 53 private final Instruction _astoreIterator; 54 private final Instruction _aloadIterator; 55 private final Instruction _astoreHandler; 56 private final Instruction _aloadHandler; 57 58 public AttributeSetMethodGenerator(String methodName, ClassGen classGen) { 59 super(org.apache.bcel.Constants.ACC_PRIVATE, 60 org.apache.bcel.generic.Type.VOID, 61 argTypes, argNames, methodName, 62 classGen.getClassName(), 63 new InstructionList(), 64 classGen.getConstantPool()); 65 66 _aloadDom = new ALOAD(DOM_INDEX); 67 _astoreDom = new ASTORE(DOM_INDEX); 68 _astoreIterator = new ASTORE(ITERATOR_INDEX); 69 _aloadIterator = new ALOAD(ITERATOR_INDEX); 70 _astoreHandler = new ASTORE(HANDLER_INDEX); 71 _aloadHandler = new ALOAD(HANDLER_INDEX); 72 } 73 74 public Instruction storeIterator() { 75 return _astoreIterator; 76 } 77 78 public Instruction loadIterator() { 79 return _aloadIterator; 80 } 81 82 public int getIteratorIndex() { 83 return ITERATOR_INDEX; 84 } 85 86 public Instruction storeHandler() { 87 return _astoreHandler; 88 } 89 90 public Instruction loadHandler() { 91 return _aloadHandler; 92 } 93 94 public int getLocalIndex(String name) { 95 return INVALID_INDEX; } 97 } 98 | Popular Tags |