|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.fractal.julia.asm.ContextClassGenerator
public class ContextClassGenerator
A class generator to generate InitializationContext
classes. This class
generates classes of the following form:
public class XYZ extends InitializationContext implements Generated { private static ComponentType componentType; private static ComponentType internalComponentType; public void create() { super.create(); ComponentType compType; if (componentType == null) { TypeFactory tf = (TypeFactory)hints; componentType = tf.createFcType(new InterfaceType[] { tf.createFcItfType(...), ... tf.createFcItfType(...) }); internalComponentType = tf.createFcType(new InterfaceType[] { tf.createFcItfType(...), ... tf.createFcItfType(...) }); } compType = componentType; controllers.add(new controller-class1()); ... controllers.add(new controller-classN()); [ if (content == null) content = new content-class(); ] Component owner = null; Object impl = controllers.get(0); interfaces.put("component", owner = new interface-class1(..., impl)); ... impl = controllers.get(I); // or impl = content; [ impl = new interceptor-classM(impl); ] [ controllers.add(impl); ] interfaces.put("...", new interface-classM(..., impl)); [ internalInterfaces.put("...", new interface-classM(..., impl)); ] return; } public String getFcGeneratorParameters() { return "(... ...)"; } }
Field Summary |
---|
Constructor Summary | |
---|---|
ContextClassGenerator()
|
Method Summary | |
---|---|
void |
computeInterfaceTypes()
Computes all the interface types of the component. |
byte[] |
generateClass(String name,
Tree args,
Loader loader,
ClassLoader classLoader)
Generates the class whose descriptor is given, with the given name. |
void |
generateCreateContent(MethodVisitor mv)
Generates the code to create the component's content. |
void |
generateCreateControllers(MethodVisitor mv)
Generates the code to create the component's controller objects. |
void |
generateCreateInterfaces(MethodVisitor mv)
Generates the code to create the component interfaces. |
void |
generateCreateType(MethodVisitor mv)
Generates the code to initialize the "componentType" and "internalComponentType" static fields of the generated class. |
protected Tree |
generateTreeDescriptor(Tree itfClassGen,
Tree itf)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ContextClassGenerator()
Method Detail |
---|
public byte[] generateClass(String name, Tree args, Loader loader, ClassLoader classLoader) throws ClassGenerationException
generateClass
in interface ClassGenerator
name
- the name of the class to be generated.args
- the descriptor of the class to be generated. This
descriptor must be of the form "(type-descriptor
controller-descriptor content-descriptor)", where "type-descriptor"
is of the form "((name signature isClient isOptional isCollection)
...)", "controller-descriptor" is of the form described in the Julia
tutorial, and "content-descriptor" is a fully qualified class name or
"EMPTY".loader
- the loader to be used to load or generate auxiliary classes,
if needed.classLoader
- the class loader to be used to load auxiliary classes,
if needed.
ClassGenerationException
- if a problem occurs during the generation
of the class.public void computeInterfaceTypes()
public void generateCreateType(MethodVisitor mv)
mv
- the code visitor to be used to generate the code.public void generateCreateControllers(MethodVisitor mv) throws ClassGenerationException
mv
- the code visitor to be used to generate the code.
ClassGenerationException
- if a problem occurspublic void generateCreateContent(MethodVisitor mv) throws ClassGenerationException
mv
- the code visitor to be used to generate the code.
ClassGenerationException
- if the component's content class cannot be
found.public void generateCreateInterfaces(MethodVisitor mv) throws ClassGenerationException
mv
- the code visitor to be used to generate the code.
ClassGenerationException
- if a problem occurs.protected Tree generateTreeDescriptor(Tree itfClassGen, Tree itf)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |