|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.fractal.julia.asm.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)
Generates the class whose descriptor is given, with the given name. |
void |
generateCreateContent(CodeVisitor mv)
Generates the code to create the component's content. |
void |
generateCreateControllers(CodeVisitor mv)
Generates the code to create the component's controller objects. |
void |
generateCreateInterfaces(CodeVisitor mv)
Generates the code to create the component interfaces. |
void |
generateCreateType(CodeVisitor mv)
Generates the code to initialize the "componentType" and "internalComponentType" static fields of the generated class. |
| 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)
throws ClassGenerationException
generateClass in interface ClassGeneratorname - 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.
ClassGenerationException - if a problem occurs during the generation
of the class.public void computeInterfaceTypes()
public void generateCreateType(CodeVisitor mv)
mv - the code visitor to be used to generate the code.
public void generateCreateControllers(CodeVisitor mv)
throws ClassGenerationException
mv - the code visitor to be used to generate the code.
ClassGenerationException - if a problem occurs
public void generateCreateContent(CodeVisitor 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(CodeVisitor mv)
throws ClassGenerationException
mv - the code visitor to be used to generate the code.
ClassGenerationException - if a problem occurs.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||