Book a Demo

Author Topic: Code generation for Constraints and TaggedValues  (Read 3017 times)

Jayesh

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Code generation for Constraints and TaggedValues
« on: April 12, 2010, 07:49:32 am »
I have a few questions about code generation
Question 1
I defined a constraint using “OCL” at the attribute level for a class. Example (age > 0)
I have also defined get/set methods for this attribute.
When I do forward code generation I do not see the constraint defined in the model transformed into a check at the “set” method to ensure that “age>0” is this how the model is suppose to work or am I missing something. Are constraints transformed into code checks or are they simply used to capture the business rules and it’s the developer’s job to code the same in the “set” methods.

Question 2
What is the use of tagged values defined at the class level in the context of code generation? I do not see any examples providing help in this context. I was under the impression that tagged values can be used to assign custom properties that are not existing in the original meta-model class. Do they result in code-generation if yes can someone give me an example in the context of Class?

Thanks