| java.lang.Object org.apache.derby.impl.services.bytecode.GClass org.apache.derby.impl.services.bytecode.BCClass
BCClass | class BCClass extends GClass (Code) | | ClassBuilder is used to construct a java class's byte array
representation.
Limitations:
No checking for language use violations such as invalid modifiers
or duplicate field names.
All classes must have a superclass; java.lang.Object must be
supplied if there is no superclass.
When a class is first created, it has:
- a superclass
- modifiers
- a name
- a package
- no superinterfaces, methods, fields, or constructors
- an empty static initializer
- an empty initializer
MethodBuilder implementations are required to supply a way for
Generators to give them code. Most typically, they may have
a stream to which the Generator writes the code that is of
the type to satisfy what the Generator is writing.
BCClass is a ClassBuilder implementation for generating java bytecode
directly.
|
Method Summary | |
public LocalField | addField(String javaType, String name, int modifiers) add a field to this class. | void | addLimitExceeded(BCMethod mb, String limitName, int limit, int value) Add the fact that some class limit was exceeded while generating
the class. | void | addLimitExceeded(String rawText) Add the fact that some class limit was exceeded while generating
the class. | public ByteArray | getClassBytecode() At the time the class is completed and bytecode
generated, if there are no constructors then
the default no-arg constructor will be defined. | ClassFactory | getClassFactory() | public String | getName() | String | getSuperClassName() | ClassHolder | modify() Let those that need to get to the
classModify tool to alter the class definition. | public MethodBuilder | newConstructorBuilder(int modifiers) a constructor. | public void | newFieldWithAccessors(String getter, String setter, int methodModifers, boolean staticField, String type) | public MethodBuilder | newMethodBuilder(int modifiers, String returnType, String methodName) a method. | public MethodBuilder | newMethodBuilder(int modifiers, String returnType, String methodName, String[] parms) a method with parameters. |
limitMsg | String limitMsg(Code) | | Simple text indicating any limits execeeded while generating
the class file.
|
addField | public LocalField addField(String javaType, String name, int modifiers)(Code) | | add a field to this class. Fields cannot
be initialized here, they must be initialized
in the static initializer code (static fields)
or in the constructors.
static fields also added to this list,
with the modifier set appropriately.
|
addLimitExceeded | void addLimitExceeded(BCMethod mb, String limitName, int limit, int value)(Code) | | Add the fact that some class limit was exceeded while generating
the class. We create a set of them and report at the end, this
allows the generated class file to still be dumped.
Parameters: mb - Parameters: limitName - Parameters: limit - Parameters: value - |
getClassBytecode | public ByteArray getClassBytecode() throws StandardException(Code) | | At the time the class is completed and bytecode
generated, if there are no constructors then
the default no-arg constructor will be defined.
|
getName | public String getName()(Code) | | the class's unqualified name
|
modify | ClassHolder modify()(Code) | | Let those that need to get to the
classModify tool to alter the class definition.
|
newConstructorBuilder | public MethodBuilder newConstructorBuilder(int modifiers)(Code) | | a constructor. Once it is created, thrown
exceptions, statements, and local variable declarations
must be added to it. It is put into its defining class
when it is created.
Java: #modifiers #className() {}
// modifiers is the | of the JVM constants for
// the modifiers such as static, public, etc.
// className is taken from definingClass.getName()
This is used to start a constructor as well; pass in
null for the returnType when used in that manner.
See Modifiers
Parameters: modifiers - the | of the Modifiersconstants representing the visibility and control of thismethod. the method builder for the constructor. |
newFieldWithAccessors | public void newFieldWithAccessors(String getter, String setter, int methodModifers, boolean staticField, String type)(Code) | | |
newMethodBuilder | public MethodBuilder newMethodBuilder(int modifiers, String returnType, String methodName)(Code) | | a method. Once it is created, thrown
exceptions, statements, and local variable declarations
must be added to it. It is put into its defining class
when it is created.
Java: #modifiers #returnType #methodName() {}
// modifiers is the | of the JVM constants for
// the modifiers such as static, public, etc.
This is used to start a constructor as well; pass in
null for the returnType when used in that manner.
See java.lang.reflect.Modifiers
Parameters: modifiers - the | of the Modifiersconstants representing the visibility and control of thismethod. Parameters: returnType - the return type of the method as itsJava language type name. Parameters: methodName - the name of the method. the method builder. |
newMethodBuilder | public MethodBuilder newMethodBuilder(int modifiers, String returnType, String methodName, String[] parms)(Code) | | a method with parameters. Once it is created, thrown
exceptions, statements, and local variable declarations
must be added to it. It is put into its defining class
when it is created.
Java: #modifiers #returnType #methodName() {}
// modifiers is the | of the JVM constants for
// the modifiers such as static, public, etc.
This is used to start a constructor as well; pass in
null for the returnType when used in that manner.
See java.lang.reflect.Modifiers
Parameters: modifiers - the | of the Modifiersconstants representing the visibility and control of thismethod. Parameters: returnType - the return type of the method as itsJava language type name. Parameters: methodName - the name of the method. Parameters: parms - an array of ParameterDeclarations representing themethod's parameters the method builder. |
|
|