Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » [OCLinEcore] Generating OCLinEcoreEObjectValidator supertype for the validator
[OCLinEcore] Generating OCLinEcoreEObjectValidator supertype for the validator [message #1029161] Fri, 29 March 2013 08:35 Go to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
Hello,

Currently, if we want to make use of custom messages or custom severity levels for OCL constraints, we have to change the generated code for our XXXXValidator class: it should extend OCLinEcoreEObjectValidator and not EObjectValidator.

I was wondering if there is a way to somehow specify that in the model (ecore model or genmodel file) in any way (annotations or properties) ?
The reason is that we would like to avoid having to version generated code.

Thanks,
Cédric
Re: [OCLinEcore] Generating OCLinEcoreEObjectValidator supertype for the validator [message #1031120 is a reply to message #1029161] Mon, 01 April 2013 07:51 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7681
Registered: July 2009
Senior Member
Hi Cedric

I don't think there is an easy solution.

Eclipse-side;

Ideally the validation API would be extended to support custom messages
making the use of OCLinEcoreEObjectValidator redundant. Unfortunately
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337792 is not progressing.

Even better the whole EValidator API might be generalized to support
customization in the same way as all the other EMF registries. Any
volunteers?

It would be possible to add a GenModel annotation to specify the
EValidator base; just needs coding and acceptance that yet another
GenModel option is necessary.

User side;

You could use a custom JET script, which may become a major maintenance
nightmare when the standard EMF scripts evolve.

You could write a custom script (one sed command) to zap the generated
validator.

Or you just live with the manually inserted @extends/@generated not.

Or, just an idea, you have a custom validator that extends/delegates to
the auto-generated functionality and adds the missing
OCLinEcoreEObjectValidator.

Regards

Ed Willink




On 29/03/2013 08:35, Cedric Moonen wrote:
> Hello,
>
> Currently, if we want to make use of custom messages or custom
> severity levels for OCL constraints, we have to change the generated
> code for our XXXXValidator class: it should extend
> OCLinEcoreEObjectValidator and not EObjectValidator.
>
> I was wondering if there is a way to somehow specify that in the model
> (ecore model or genmodel file) in any way (annotations or properties) ?
> The reason is that we would like to avoid having to version generated
> code.
> Thanks,
> Cédric
Previous Topic:Stereotype attributes and multiplicities
Next Topic:Content assist behavior in embedded xtext ocl editor
Goto Forum:
  


Current Time: Thu Dec 26 23:48:19 GMT 2024

Powered by FUDForum. Page generated in 0.03187 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top