|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.objectweb.asm.xml.ASMContentHandler
public class ASMContentHandler
A ContentHandler that transforms XML
document into Java class file. This class can be feeded by any kind of SAX
2.0 event producers, e.g. XML parser, XSLT or XPath engines, or custom code.
SAXClassAdapter,
Processor| Field Summary | |
|---|---|
private static java.lang.String |
BASE
|
protected boolean |
computeMax
true if the maximum stack size and number of local variables must be automatically computed. |
protected ClassWriter |
cw
Current instance of the ClassWriter used to write
class bytecode. |
protected java.util.Map |
labels
Map of the active Label instances for current method. |
private java.lang.String |
match
Complete name of the current element. |
(package private) static java.util.Map |
OPCODES
Map of the opcode names to opcode and opcode group |
protected java.io.OutputStream |
os
Output stream to write result bytecode. |
private ASMContentHandler.RuleSet |
RULES
|
private java.util.List |
stack
Stack of the intermediate processing contexts. |
private static java.util.Map |
TYPES
|
| Constructor Summary | |
|---|---|
ASMContentHandler(java.io.OutputStream os,
boolean computeMax)
Constructs a new ASMContentHandler object. |
|
| Method Summary | |
|---|---|
private static void |
addOpcode(java.lang.String operStr,
int oper,
int group)
|
void |
endDocument()
Process notification of the end of a document and write generated bytecode into output stream. |
void |
endElement(java.lang.String ns,
java.lang.String lName,
java.lang.String qName)
Process notification of the end of an XML element being reached. |
(package private) java.lang.Object |
peek()
Return the top object on the stack without removing it. |
(package private) java.lang.Object |
pop()
Pop the top object off of the stack, and return it. |
(package private) void |
push(java.lang.Object object)
Push a new object onto the top of the object stack. |
void |
startElement(java.lang.String ns,
java.lang.String lName,
java.lang.String qName,
org.xml.sax.Attributes list)
Process notification of the start of an XML element being reached. |
byte[] |
toByteArray()
Returns the bytecode of the class that was build with underneath class writer. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
characters, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final java.util.List stack
private java.lang.String match
protected boolean computeMax
protected java.io.OutputStream os
protected ClassWriter cw
ClassWriter used to write
class bytecode.
protected java.util.Map labels
Label instances for current method.
private static final java.lang.String BASE
private final ASMContentHandler.RuleSet RULES
static final java.util.Map OPCODES
private static final java.util.Map TYPES
| Constructor Detail |
|---|
public ASMContentHandler(java.io.OutputStream os,
boolean computeMax)
ASMContentHandler object.
os - output stream to write generated class.computeMax - true if the maximum stack size and the
maximum number of local variables must be automatically computed.
This value is passed to ClassWriter instance.| Method Detail |
|---|
private static void addOpcode(java.lang.String operStr,
int oper,
int group)
public byte[] toByteArray()
public final void startElement(java.lang.String ns,
java.lang.String lName,
java.lang.String qName,
org.xml.sax.Attributes list)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerns - - The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace processing is not being performed.lName - - The local name (without prefix), or the empty string if
Namespace processing is not being performed.qName - - The qualified name (with prefix), or the empty string if
qualified names are not available.list - - The attributes attached to the element. If there are no
attributes, it shall be an empty Attributes object.
org.xml.sax.SAXException - if a parsing error is to be reported
public final void endElement(java.lang.String ns,
java.lang.String lName,
java.lang.String qName)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerns - - The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace processing is not being performed.lName - - The local name (without prefix), or the empty string if
Namespace processing is not being performed.qName - - The qualified XML 1.0 name (with prefix), or the empty
string if qualified names are not available.
org.xml.sax.SAXException - if a parsing error is to be reported
public final void endDocument()
throws org.xml.sax.SAXException
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException - if parsing or writing error is to be reported.final java.lang.Object peek()
null.
final java.lang.Object pop()
null.
final void push(java.lang.Object object)
object - The new object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||