Author Topic: Java Code GEneration Question (tags, stereotypes)  (Read 991 times)

angel-o-sphere

  • EA User
  • **
  • Posts: 112
  • Karma: +0/-0
    • View Profile
Java Code GEneration Question (tags, stereotypes)
« on: March 05, 2004, 06:48:42 am »
Hi,

I like to fiddle a bit with the code generation templates.

My problem/wish is like this:

I use interfaces to define properties needed by classes implementing the interfaces.

Example:

interface HasName {
  String getName();
  void setName(String name);
}

class User implements HasName {
String name; // how to generate this?
  String getName() {
     return name; // how to generate this?
  }

  void setName(String name) {
      this.name = name; // how to generate this?
  }
}

I like to "upgrade" the code generation templates to recognize that the interface specifies a "Property", e.g. by using a tagged value or a stereotype.

All parts above marked with "// how to generate this?" should be generated.

Any hints?

Well, even better would be a way to use metamodelling to not only generate this into the source but generate it inside of EA as method body and visible attribute.

That means some automation or some stereotype and tags magic could do it :D if EA supports that.

Regards,
  angel'o'sphere