public class InterfaceCreator extends AbstractClassCreatorContext
haveInitMethod, scclassOutPutPath, cw, existedStaticBlock, fieldCreators, methodCreaters| 构造器和说明 |
|---|
InterfaceCreator(int version,
String name,
Class<?>[] interfaces)
Interface Creator
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
createDefaultConstructor() |
IFieldCreator |
createField(String name,
AClass type)
create a global variable. the modifiers "public static final".
|
IFieldCreator |
createField(String name,
AClass type,
Object value)
create a global variable with special value. the modifiers "public static final".
|
void |
createMethod(String name,
AClass[] argClasses,
AClass returnClass,
AClass[] exceptions)
Create an interface method
|
void |
createMethod(String name,
AClass[] argClasses,
AClass returnClass,
AClass[] exceptions,
boolean isVarargs)
declare an interface method
|
InterfaceCreator |
createStaticBlock(KernelStaticBlockBody clinitb)
create a static block.
|
beforeCreate, getCurrentClass, startupcheckStaticBlock, getClassOutPutPath, getClassVisitor, getParentClassLoader, loadClass, setClassOutPutPath, setParentClassLoadergetArrayType, getArrayType, getType, newSemiClasspublic void createMethod(String name, AClass[] argClasses, AClass returnClass, AClass[] exceptions)
name - method nameargClasses - returnClass - exceptions - public void createMethod(String name, AClass[] argClasses, AClass returnClass, AClass[] exceptions, boolean isVarargs)
name - method nameargClasses - method argument typesreturnClass - method return type, if null than indicate voidexceptions - what exception you want explicit throw.public IFieldCreator createField(String name, AClass type)
create a global variable. the modifiers "public static final". The default value is same to JVM
if you want assign special value to this variable,
you need do it at static block.
name - type - public IFieldCreator createField(String name, AClass type, Object value)
create a global variable with special value. the modifiers "public static final". The default value is same to JVM
if you want assign special value to this variable,
you need do it at static block.
name - variable nametype - value - The initial value, this value is only support static field,
otherwise will ignored.This parameter, which may be null
if the field does not have an initial value,
must be an Integer, a Float, a Long, a Double or a
String (for int, float, long or String fields respectively).
This parameter is only used for static fields. Its value is
ignored for non static fields, which must be initialized
through bytecode instructions in constructors or methods.public InterfaceCreator createStaticBlock(KernelStaticBlockBody clinitb)
create a static block.
you can call this method just on time.
this is different write java code. we can write any java cod
mb - Method Bodyprotected final void createDefaultConstructor()
Copyright © 2015. All rights reserved.