Constraints through Annotations in Ecore model [message #558454] |
Mon, 13 September 2010 04:37 |
Animesh Kumar Messages: 18 Registered: September 2010 Location: Bangalore |
Junior Member |
|
|
Hi,
I was trying to make constraints through annotations in ECore Model.
I have created the constraint in the model using annotation. I have also generated the code for it, which generates a ModelValidator class in the util package. But the the generated class has validate methods which takes arguments whose values are unknown to me. For eg.
protected boolean validate(int classifierID, Object value,
DiagnosticChain diagnostics, Map<Object, Object> context);
(or)
public boolean validateCompany_ValidName(Company companyName,
DiagnosticChain diagnostics, Map<Object, Object> context)
How can i invoke these methods when i don't have any known value for DiagnosticChain or the Map for context. Do i have to create my own implementations of these methods?
Regards,
Animesh
|
|
|
Re: Constraints through Annotations in Ecore model [message #558567 is a reply to message #558454] |
Mon, 13 September 2010 14:06 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Animesh,
Typically you invoke the validator via Diagnostican.INSTANCE rather than
by directly calling those methods.
Animesh Kumar wrote:
> Hi,
> I was trying to make constraints through annotations in ECore Model.
> I have created the constraint in the model using annotation. I have
> also generated the code for it, which generates a ModelValidator class
> in the util package. But the the generated class has validate methods
> which takes arguments whose values are unknown to me. For eg.
>
> protected boolean validate(int classifierID, Object value,
> DiagnosticChain diagnostics, Map<Object, Object> context);
>
> (or)
>
> public boolean validateCompany_ValidName(Company companyName,
> DiagnosticChain diagnostics, Map<Object, Object> context)
>
> How can i invoke these methods when i don't have any known value for
> DiagnosticChain or the Map for context. Do i have to create my own
> implementations of these methods?
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02211 seconds