1 16 19 20 package com.sun.org.apache.xalan.internal.xsltc.compiler.util; 21 22 import com.sun.org.apache.bcel.internal.generic.ALOAD; 23 import com.sun.org.apache.bcel.internal.generic.ClassGen; 24 import com.sun.org.apache.bcel.internal.generic.Instruction; 25 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; 26 import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser; 27 import com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet; 28 29 45 public class ClassGenerator extends ClassGen { 46 protected static int TRANSLET_INDEX = 0; 47 protected static int INVALID_INDEX = -1; 48 49 private Stylesheet _stylesheet; 50 private final Parser _parser; private final Instruction _aloadTranslet; 53 private final String _domClass; 54 private final String _domClassSig; 55 private final String _applyTemplatesSig; 56 57 public ClassGenerator(String class_name, String super_class_name, 58 String file_name, 59 int access_flags, String [] interfaces, 60 Stylesheet stylesheet) { 61 super(class_name, super_class_name, file_name, 62 access_flags, interfaces); 63 _stylesheet = stylesheet; 64 _parser = stylesheet.getParser(); 65 _aloadTranslet = new ALOAD(TRANSLET_INDEX); 66 67 if (stylesheet.isMultiDocument()) { 68 _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM"; 69 _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM;"; 70 } 71 else { 72 _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter"; 73 _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter;"; 74 } 75 _applyTemplatesSig = "(" 76 + Constants.DOM_INTF_SIG 77 + Constants.NODE_ITERATOR_SIG 78 + Constants.TRANSLET_OUTPUT_SIG 79 + ")V"; 80 } 81 82 public final Parser getParser() { 83 return _parser; 84 } 85 86 public final Stylesheet getStylesheet() { 87 return _stylesheet; 88 } 89 90 94 public final String getClassName() { 95 return _stylesheet.getClassName(); 96 } 97 98 public Instruction loadTranslet() { 99 return _aloadTranslet; 100 } 101 102 public final String getDOMClass() { 103 return _domClass; 104 } 105 106 public final String getDOMClassSig() { 107 return _domClassSig; 108 } 109 110 public final String getApplyTemplatesSig() { 111 return _applyTemplatesSig; 112 } 113 114 118 public boolean isExternal() { 119 return false; 120 } 121 } 122 | Popular Tags |