|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.fractal.julia.asm.AbstractClassGenerator
org.objectweb.fractal.julia.asm.InterfaceClassGenerator
A class generator to generate Interface
classes. This class generator generates sub classes of a given
Interface class that
implements the given set of interfaces. The super class must be a sub class
of the BasicComponentInterface class.
The code generated for the I interface below is the following:
public interface I {
void m ();
}
public class XYZ extends superClass implements I, Generated {
private I impl;
public XYZ () {
}
public XYZ (Component o, String n, Type t, boolean b, Object impl) {
super(o, n, t, b, impl);
}
public void m () {
impl.m();
}
public Object getFcItfImpl () {
return impl;
}
public void setFcItfImpl (Object impl) {
this.impl = (I)impl;
}
public String getFcGeneratorParameters () {
return "(... superClass (I))";
}
}
If there is more than one interface, some additional casts are used:
public class XY extends superClass implements I, J, Generated {
private Object impl;
public XY () {
}
public XY (Component o, String n, Type t, boolean b, Object impl) {
super(o, n, t, b, impl);
}
public void m () {
((I)impl).m();
}
public void n () {
((J)impl).n();
}
public Object getFcItfImpl () {
return impl;
}
public void setFcItfImpl (Object impl) {
this.impl = impl;
}
public String getFcGeneratorParameters () {
return "(... superClass (I J))";
}
}
| Field Summary |
|---|
| Fields inherited from class org.objectweb.fractal.julia.asm.AbstractClassGenerator |
|---|
cw, interfaces, loader, name, parameters, superClass |
| Constructor Summary | |
|---|---|
InterfaceClassGenerator()
|
|
| Method Summary | |
|---|---|
protected void |
generateConstructor()
Generates the constructor of the class to be generated. |
protected void |
generateDefaultMethods()
Calls the overriden method and generates the getFcItfImpl
and setFcItfImpl methods. |
protected void |
generateMethod(Method m)
Generates a method that forwards calls to the 'impl' object. |
protected String |
getSource()
Returns the source of the class to be generated. |
void |
initialize(Tree args)
Initializes this object with the given arguments. |
protected void |
parseArgs(Tree args)
Initializes this class generator with the given arguments. |
| Methods inherited from class org.objectweb.fractal.julia.asm.AbstractClassGenerator |
|---|
computeMaxs, generateClass, generateHeader, generateInterfaceMethods, getImplementedInterfaces, getOpcodeOffset, getSize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public InterfaceClassGenerator()
| Method Detail |
public void initialize(Tree args)
throws Exception
initialize in interface Initializableargs - the arguments to be used to initialize this object. The format
of these arguments depends on the class of this object.
Exception - if a problem occurs during the object initialization.protected void parseArgs(Tree args)
parseArgs in class AbstractClassGeneratorargs - the descriptor of the class to be generated.protected String getSource()
getSource in class AbstractClassGenerator
protected void generateConstructor()
throws ClassGenerationException
BasicComponentInterface class.
generateConstructor in class AbstractClassGeneratorClassGenerationException - if a problem occurs.
protected void generateDefaultMethods()
throws ClassGenerationException
getFcItfImpl
and setFcItfImpl methods.
generateDefaultMethods in class AbstractClassGeneratorClassGenerationException - if a problem occurs.protected void generateMethod(Method m)
generateMethod in class AbstractClassGeneratorm - the method that must be generated.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||