Javassist 3.15.0-GA-redhat-2

javassist.bytecode
Class ClassFileWriter.MethodWriter

java.lang.Object
  extended by javassist.bytecode.ClassFileWriter.MethodWriter
Enclosing class:
ClassFileWriter

public static final class ClassFileWriter.MethodWriter
extends Object

Method.


Field Summary
protected  int codeIndex
           
protected  ClassFileWriter.ConstPoolWriter constPool
           
protected  javassist.bytecode.ByteStream output
           
protected  int stackIndex
           
protected  int throwsIndex
           
 
Method Summary
 void add(int b)
          Appends an 8bit value of bytecode.
 void add16(int b)
          Appends a 16bit value of bytecode.
 void add32(int b)
          Appends a 32bit value of bytecode.
 void addCatch(int startPc, int endPc, int handlerPc, int catchType)
          Appends an exception_table entry to the Code_attribute.
 void addInvoke(int opcode, String targetClass, String methodName, String descriptor)
          Appends a invokevirtual, inovkespecial, or invokestatic bytecode.
 void begin(int accessFlags, int name, int descriptor, int[] exceptions, ClassFileWriter.AttributeWriter aw)
          Starts adding a new method.
 void begin(int accessFlags, String name, String descriptor, String[] exceptions, ClassFileWriter.AttributeWriter aw)
          Starts Adding a new method.
 void codeEnd(int maxStack, int maxLocals)
          Ends appending bytecode.
 void end(StackMapTable.Writer smap, ClassFileWriter.AttributeWriter aw)
          Ends adding a new method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

output

protected javassist.bytecode.ByteStream output

constPool

protected ClassFileWriter.ConstPoolWriter constPool

codeIndex

protected int codeIndex

throwsIndex

protected int throwsIndex

stackIndex

protected int stackIndex
Method Detail

begin

public void begin(int accessFlags,
                  String name,
                  String descriptor,
                  String[] exceptions,
                  ClassFileWriter.AttributeWriter aw)
Starts Adding a new method.

Parameters:
accessFlags - access flags.
name - the method name.
descriptor - the method signature.
exceptions - throws clause. It may be null. The class names must be the JVM-internal representations like java/lang/Exception.
aw - attributes to the Method_info.

begin

public void begin(int accessFlags,
                  int name,
                  int descriptor,
                  int[] exceptions,
                  ClassFileWriter.AttributeWriter aw)
Starts adding a new method.

Parameters:
accessFlags - access flags.
name - the method name. an index indicating its CONSTANT_Utf8_info.
descriptor - the field type. an index indicating its CONSTANT_Utf8_info.
exceptions - throws clause. indexes indicating CONSTANT_Class_infos. It may be null.
aw - attributes to the Method_info.

add

public void add(int b)
Appends an 8bit value of bytecode.

See Also:
Opcode

add16

public void add16(int b)
Appends a 16bit value of bytecode.


add32

public void add32(int b)
Appends a 32bit value of bytecode.


addInvoke

public void addInvoke(int opcode,
                      String targetClass,
                      String methodName,
                      String descriptor)
Appends a invokevirtual, inovkespecial, or invokestatic bytecode.

See Also:
Opcode

codeEnd

public void codeEnd(int maxStack,
                    int maxLocals)
Ends appending bytecode.


addCatch

public void addCatch(int startPc,
                     int endPc,
                     int handlerPc,
                     int catchType)
Appends an exception_table entry to the Code_attribute. This method is available only after the codeEnd method is called.

Parameters:
catchType - an index indicating a CONSTANT_Class_info.

end

public void end(StackMapTable.Writer smap,
                ClassFileWriter.AttributeWriter aw)
Ends adding a new method. The add method must be called before the end method is called.

Parameters:
smap - a stack map table. may be null.
aw - attributes to the Code_attribute. may be null.

Javassist 3.15.0-GA-redhat-2

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.