|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JavaFactory
JavaFactory provides generators for Java constructs. Once Java constructs have been connected into a complete class definition, the class can be generated from them. The generated class is created as a byte-code array that can then be loaded by a class loader or, in our case, the class utilities wrapper around our special class loader.
Each method shows the equivalent Java in the line starting
"Java:" in the header comment. Items in the java code that
begin with # refer to parameters used in constructing the
object. So, for example, newReturnStatement takes a parameter
named value; its Java code is:
This represents the fact that newReturnStatement returns a object that represents a return statement that returns the value represented by the parameter named value.
REVISIT: when StandardException is moved to BasicServices, all of these want to support it so they can throw real NotImplementedYet exceptions. It is expected that alot of this interface can be not-implemented for engines that do not need this complete treatment of the language.
Known Java constructs missing from this interface include:
This interface also does not do real compilation -- there are no checks for things like initialization before use of variables, inclusion of catchs on throws, dead code, etc. Its purpose is to let other parts of the system piece together what they know is valid code and get bytecode out of doing that.
Also, implementations will require that the constructs be built appropriately or they may fail to produce a valid class. For example, newStaticMethodCall must be used to call static methods only, not non-static local instance methods.
Implementations may be more, or less strict. You are best off assuming you have to piece together each java construct and be as explicit as possible. So, constructors must be created with newConstructor, not newMethodBuilder; constructors must include the explicit call to super(...) or this(...), as their first statement; all methods and constructors must contain a final return statement at the end of their code path(s). Method calls will derive the method to call based on the type of the argument, so you must cast arguments as the system will not search for a close method and coerce arguments appropriately. This includes coercing them to be some superclass or interface that they already are.
Field Summary | |
---|---|
static java.lang.String |
JAVA_FACTORY_PROPERTY
|
Method Summary | |
---|---|
ClassBuilder |
newClassBuilder(ClassFactory cf,
java.lang.String packageName,
int modifiers,
java.lang.String className,
java.lang.String superClass)
a class. |
Field Detail |
---|
static final java.lang.String JAVA_FACTORY_PROPERTY
Method Detail |
---|
ClassBuilder newClassBuilder(ClassFactory cf, java.lang.String packageName, int modifiers, java.lang.String className, java.lang.String superClass)
cf
- ClassFactory to be used for class resolution (debug only)
and loading of the generated class.packageName
- the name of the package the class is in
including the trailing 'dot' if it is not the empty package.
Pass the empty package as "".modifiers
- the | of the Modifier
constants representing the visibility and control of this
method.className
- the name of the class or interfacesuperClass
- the name of the superclass or superinterface
Modifier
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |