org.objectweb.asm.util

Class AbstractVisitor

Known Direct Subclasses:
ASMifierAbstractVisitor, ASMifierAnnotationVisitor, TraceAbstractVisitor

public abstract class AbstractVisitor
extends Object

An abstract visitor.

Author:
Eric Bruneton

Field Summary

static String[]
OPCODES
The names of the Java Virtual Machine opcodes.
protected StringBuffer
buf
A buffer that can be used to create strings.
List
text
The text to be printed.

Constructor Summary

AbstractVisitor()
Constructs a new AbstractVisitor.

Method Summary

static void
appendString(StringBuffer buf, String s)
Appends a quoted string to a given buffer.
static Attribute[]
getDefaultAttributes()
Returns the default ASMifiable prototypes.
List
getText()
Returns the text printed by this visitor.

Field Details

OPCODES

public static final String[] OPCODES
The names of the Java Virtual Machine opcodes.


buf

protected final StringBuffer buf
A buffer that can be used to create strings.


text

public final List text
The text to be printed. Since the code of methods is not necessarily visited in sequential order, one method after the other, but can be interlaced (some instructions from method one, then some instructions from method two, then some instructions from method one again...), it is not possible to print the visited instructions directly to a sequential stream. A class is therefore printed in a two steps process: a string tree is constructed during the visit, and printed to a sequential stream at the end of the visit. This string tree is stored in this field, as a string list that can contain other string lists, which can themselves contain other string lists, and so on.

Constructor Details

AbstractVisitor

protected AbstractVisitor()

Method Details

appendString

public static void appendString(StringBuffer buf,
                                String s)
Appends a quoted string to a given buffer.

Parameters:
buf - the buffer where the string must be added.
s - the string to be added.


getDefaultAttributes

public static Attribute[] getDefaultAttributes()
Returns the default ASMifiable prototypes.

Returns:
the default ASMifiable prototypes.


getText

public List getText()
Returns the text printed by this visitor.

Returns:
the text printed by this visitor.