org.objectweb.asm.util
Class AbstractVisitor

java.lang.Object
  extended by org.objectweb.asm.util.AbstractVisitor
Direct Known Subclasses:
ASMifierAbstractVisitor, ASMifierAnnotationVisitor, TraceAbstractVisitor

public abstract class AbstractVisitor
extends java.lang.Object

An abstract visitor.

Author:
Eric Bruneton

Field Summary
protected  java.lang.StringBuffer buf
          A buffer that can be used to create strings.
static java.lang.String[] OPCODES
          The names of the Java Virtual Machine opcodes.
 java.util.List text
          The text to be printed.
static java.lang.String[] TYPES
          Types for operand parameter of the MethodVisitor.visitIntInsn(int, int) method when opcode is NEWARRAY.
 
Constructor Summary
protected AbstractVisitor()
          Constructs a new AbstractVisitor.
 
Method Summary
static void appendString(java.lang.StringBuffer buf, java.lang.String s)
          Appends a quoted string to a given buffer.
static Attribute[] getDefaultAttributes()
          Returns the default ASMifiable prototypes.
 java.util.List getText()
          Returns the text constructed by this visitor.
 void print(java.io.PrintWriter pw)
          Prints the text constructed by this visitor.
(package private)  void printList(java.io.PrintWriter pw, java.util.List l)
          Prints the given string tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPCODES

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


TYPES

public static final java.lang.String[] TYPES
Types for operand parameter of the MethodVisitor.visitIntInsn(int, int) method when opcode is NEWARRAY.


text

public final java.util.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.


buf

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

Constructor Detail

AbstractVisitor

protected AbstractVisitor()
Constructs a new AbstractVisitor.

Method Detail

getText

public java.util.List getText()
Returns the text constructed by this visitor.

Returns:
the text constructed by this visitor.

print

public void print(java.io.PrintWriter pw)
Prints the text constructed by this visitor.

Parameters:
pw - the print writer to be used.

appendString

public static void appendString(java.lang.StringBuffer buf,
                                java.lang.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.

printList

void printList(java.io.PrintWriter pw,
               java.util.List l)
Prints the given string tree.

Parameters:
pw - the writer to be used to print the tree.
l - a string tree, i.e., a string list that can contain other string lists, and so on recursively.

getDefaultAttributes

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

Returns:
the default ASMifiable prototypes.