I wanted to test a very simple model for code generation.
I created a profile with a stereotype that the stereotype has three attributes: a, b and c
Next, I created a model instance of that profile such that a class of instance model has an operation on a, b and c.
If I try to generate the code out of the model instance by right click-->Designer--> generate java code, the generated code is not correct. Can any one help me and explain how i can generate the code properly? I attach the simple profile and the model instance.
I looked at your example and I'm not sure what you expect: the generated code does not compile, since the three variables a, b, and c (referenced from your opaque behavior) are not declared. You declare a stereotype with the attributes a, b and c in your specific profile, but the code generator does not know this profile and therefore ignores it.
If you want to add attributes to your class, declare them directly as UML properties (with an optional default value). Note that stereotype attributes are not UML properties, they extend properties of the meta-model.