[OCLinEcore] Generating OCLinEcoreEObjectValidator supertype for the validator [message #1029161] |
Fri, 29 March 2013 04:35  |
Eclipse User |
|
|
|
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 03:51  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.30088 seconds