com.alibaba.fastjson.asm
类 ClassWriter

java.lang.Object
  继承者 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.

作者:
Eric Bruneton

字段摘要
static int COMPUTE_FRAMES
          Flag to automatically compute the stack map frames of methods from scratch.
static int COMPUTE_MAXS
          Flag to automatically compute the maximum stack size and the maximum number of local variables of methods.
 
构造方法摘要
ClassWriter()
           
 
方法摘要
 int newClass(String value)
           
 int newNameType(String name, String desc)
           
 int newUTF8(String value)
           
 byte[] toByteArray()
          Returns the bytecode of the class that was build with this class writer.
 void visit(int version, int access, String name, String superName, String[] interfaces)
           
 FieldVisitor visitField(int access, String name, String desc)
           
 MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
           
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

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.

另请参见:
ClassWriter(int), 常量字段值

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.

另请参见:
ClassWriter(int), 常量字段值
构造方法详细信息

ClassWriter

public ClassWriter()
方法详细信息

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)

toByteArray

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

返回:
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-2014 Alibaba Group. All Rights Reserved.