InstantGenerator templates

Hello,

I’d like to write my custom templates for instant generator. Code generation would be customized using stereotypes and tagged values of generated elements. But I can’t find possibility to retrieve tagged values and stereotypes.
I’m not sure, if my idea conforms to Your strategy. Are code generation templates the way for users to create code that fits better to their needs, or are they only Your internal design solution?

Regards,
Jacek

Hello Jacek,

We will support this in the coming version. I will provide you with more information once it is released.

Best regards,
Jick

Hello Jacek,

How are you? I am glad to inform you that Service Pack 1 is released. With Service Pack 1 you can retrieve stereotypes and tagged values using template. These are the available methods:

addTaggedValue(TemplateTaggedValue) : boolean
removeTaggedValue(TemplateTaggedValue) : boolean
taggedValueIterator() : Iterator
taggedValueCount() : int
taggedValueArray() : TemplateTaggedValue[]
taggedValueAt(int) : TemplateTaggedValue
getTaggedValue(String) : TemplateTaggedValue
getTaggedValueIgnoreCase(String) : TemplateTaggedValue
hasTaggedValue(String) : boolean
hasTaggedValueIgnoreCase(String) : boolean
addStereotype(TemplateStereotype) : boolean
removeStereotype(TemplateStereotype) : boolean
stereotypeIterator() : Iterator
stereotypeCount() : int
stereotypeArray() : TemplateStereotype[]
stereotypeAt(int) : TemplateStereotype
getStereotype(String) : TemplateStereotype
getStereotypeIgnoreCase(String) : TemplateStereotype
hasStereotype(String) : boolean
hasStereotypeIgnoreCase(String) : boolean

Attached is an example for you.

To advance to the Service Pack 1, please run the product updater inside the bin folder of VP Suite installation folder.

Hope this helps. Enjoy.

Best regards,
Jick
example.zip

Hello Jick,

I tried these features yesterday evening. They are really nice. Underscores in stereotype names confused me a little bit, but only for the moment.
Possibility to generate names following MS naming conventions is nice too.

Thank you,
Jacek

Hello Jacek,

I am glad to know that the fix works. However, I do not quite understand your suggestion about the underscores in stereotypes. Could you provide me with more detail. By clarifying your need, I will discuss with our engineers.

Best regards,
Jick

Hello,
If a particular class has the ORM Persistable stereotype, I have to call hasStereotype(“ORM_Persistable”) to examine it. It’s not a problem, since I discovered, than I should replace spaces with underscores.

Regards,
Jacek

Hi Jacek,

Okay. I got it :-o

Best regards,
Jick