|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.fractal.julia.asm.AbstractClassGenerator org.objectweb.fractal.julia.asm.AttributeControllerClassGenerator
public class AttributeControllerClassGenerator
A class generator to generate AttributeController
classes. This generator produces classes that implement a given set of
attribute controller interfaces, i.e., interfaces with only getXXX
and setXXX methods. The methods that are generated to implement
these interfaces store and retrieve values in private fields of the generated
class, two for each method pair.
More precisely, the code generated for the IAttributes interface below is the following:
public interface IAttributes extends AttributeController { int getI (); void setI (int i); } public class XYZ implements IAttributes, CloneableAttributeController, Generated { private int I; private boolean _I; // true if I has been set public int getI () { return I; } public void setI (int i) { I = i; _I = true; } public void cloneFcAttributes (AttributeController ac) { if (_I) { ((IAttributes)ac).setI(I); } } public String getFcGeneratorParameters () { return "(... ... (IAttributes))"; } }
Field Summary |
---|
Fields inherited from class org.objectweb.fractal.julia.asm.AbstractClassGenerator |
---|
classLoader, cw, interfaces, loader, name, parameters, superClass |
Constructor Summary | |
---|---|
AttributeControllerClassGenerator()
|
Method Summary | |
---|---|
protected void |
generateDefaultMethods()
Calls the overriden method and generates the header of the cloneFcAttributes method. |
protected void |
generateInterfaceMethods()
Calls the overriden method and finishes the generation of the cloneFcAttributes method. |
protected void |
generateMethod(Method m)
Generates a getter or setter method, and the corresponding fields if they are not already generated. |
protected List |
getImplementedInterfaces()
Adds CloneableAttributeController to the list returned by the
overriden method. |
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, generateConstructor, generateHeader, getOpcodeOffset, getSize, getSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AttributeControllerClassGenerator()
Method Detail |
---|
protected void parseArgs(Tree args)
parseArgs
in class AbstractClassGenerator
args
- the descriptor of the class to be generated.protected List getImplementedInterfaces() throws ClassGenerationException
CloneableAttributeController
to the list returned by the
overriden method.
getImplementedInterfaces
in class AbstractClassGenerator
ClassGenerationException
- if a problem occurs.protected void generateDefaultMethods() throws ClassGenerationException
cloneFcAttributes
method.
generateDefaultMethods
in class AbstractClassGenerator
ClassGenerationException
- if a problem occurs.protected void generateInterfaceMethods() throws ClassGenerationException
cloneFcAttributes
method.
generateInterfaceMethods
in class AbstractClassGenerator
ClassGenerationException
- if a problem occurs.protected void generateMethod(Method m)
cloneFcAttributes
method.
generateMethod
in class AbstractClassGenerator
m
- the method to be generated.
ClassGenerationException
- if a problem occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |