ClassWriter (fastjson 1.1.26 API)

fastjson



com.alibaba.fastjson.asm Class ClassWriter

java.lang.Object
  extended by com.alibaba.fastjson.asm.ClassWriter

public class ClassWriter
extends Object

A ClassVisitor that generates classes in bytecode form. More precisely this visitor generates a byte array conforming to the Java class file format. It can be used alone, to generate a Java class "from scratch", or with one or more and adapter class visitor to generate a modified class from one or more existing Java classes.

Author:
Eric Bruneton

Field Summary
static int
static int
 
Constructor Summary
 
Method Summary
 int
 int
 int
 byte[]
 void
 void
 FieldVisitor
 MethodVisitor
 
Methods inherited from class java.lang.Object
 

Field Detail

COMPUTE_MAXS

public static final int COMPUTE_MAXS
Flag to automatically compute the maximum stack size and the maximum number of local variables of methods. If this flag is set, then the arguments of the visitMaxs method of the MethodVisitor returned by the visitMethod method will be ignored, and computed automatically from the signature and the bytecode of each method.

See Also:
ClassWriter(int), Constant Field Values


COMPUTE_FRAMES

public static final int COMPUTE_FRAMES
Flag to automatically compute the stack map frames of methods from scratch. If this flag is set, then the calls to the MethodVisitor#visitFrame method are ignored, and the stack map frames are recomputed from the methods bytecode. The arguments of the visitMaxs method are also ignored and recomputed from the bytecode. In other words, computeFrames implies computeMaxs.

See Also:
ClassWriter(int), Constant Field Values

Constructor Detail

ClassWriter

public ClassWriter()
Method Detail

visit

public void visit(int version,
                  int access,
                  String name,
                  String superName,
                  String[] interfaces)

visitField

public FieldVisitor visitField(int access,
                               String name,
                               String desc)

visitMethod

public MethodVisitor visitMethod(int access,
                                 String name,
                                 String desc,
                                 String signature,
                                 String[] exceptions)

visitEnd

public void visitEnd()

toByteArray

public byte[] toByteArray()
Returns the bytecode of the class that was build with this class writer.

Returns:
the bytecode of the class that was build with this class writer.

newUTF8

public int newUTF8(String value)

newClass

public int newClass(String value)

newNameType

public int newNameType(String name,
                       String desc)


Copyright © 2012 Alibaba Group. All Rights Reserved.