Package javassist.bytecode
Class ClassFileWriter.MethodWriter
- java.lang.Object
- 
- javassist.bytecode.ClassFileWriter.MethodWriter
 
- 
- Enclosing class:
- ClassFileWriter
 
 public static final class ClassFileWriter.MethodWriter extends java.lang.ObjectMethod.
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int b)Appends an 8bit value of bytecode.voidadd16(int b)Appends a 16bit value of bytecode.voidadd32(int b)Appends a 32bit value of bytecode.voidaddCatch(int startPc, int endPc, int handlerPc, int catchType)Appends anexception_tableentry to theCode_attribute.voidaddInvoke(int opcode, java.lang.String targetClass, java.lang.String methodName, java.lang.String descriptor)Appends a invokevirtual, inovkespecial, or invokestatic bytecode.voidbegin(int accessFlags, int name, int descriptor, int[] exceptions, ClassFileWriter.AttributeWriter aw)Starts adding a new method.voidbegin(int accessFlags, java.lang.String name, java.lang.String descriptor, java.lang.String[] exceptions, ClassFileWriter.AttributeWriter aw)Starts Adding a new method.voidcodeEnd(int maxStack, int maxLocals)Ends appending bytecode.voidend(StackMapTable.Writer smap, ClassFileWriter.AttributeWriter aw)Ends adding a new method.intsize()Returns the length of the bytecode that has been added so far.
 
- 
- 
- 
Method Detail- 
beginpublic void begin(int accessFlags, java.lang.String name, java.lang.String descriptor, java.lang.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.
 
 - 
beginpublic 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.
 
 - 
addpublic void add(int b) Appends an 8bit value of bytecode.- See Also:
- Opcode
 
 - 
add16public void add16(int b) Appends a 16bit value of bytecode.
 - 
add32public void add32(int b) Appends a 32bit value of bytecode.
 - 
addInvokepublic void addInvoke(int opcode, java.lang.String targetClass, java.lang.String methodName, java.lang.String descriptor)Appends a invokevirtual, inovkespecial, or invokestatic bytecode.- See Also:
- Opcode
 
 - 
codeEndpublic void codeEnd(int maxStack, int maxLocals)Ends appending bytecode.
 - 
addCatchpublic void addCatch(int startPc, int endPc, int handlerPc, int catchType)Appends anexception_tableentry to theCode_attribute. This method is available only after thecodeEndmethod is called.- Parameters:
- catchType- an index indicating a- CONSTANT_Class_info.
 
 - 
endpublic void end(StackMapTable.Writer smap, ClassFileWriter.AttributeWriter aw) Ends adding a new method. Theaddmethod must be called before theendmethod is called.- Parameters:
- smap- a stack map table. may be null.
- aw- attributes to the- Code_attribute. may be null.
 
 - 
sizepublic int size() Returns the length of the bytecode that has been added so far.- Returns:
- the length in bytes.
- Since:
- 3.19
 
 
- 
 
-