Constraints through Annotations in Ecore model [message #558454] |
Mon, 13 September 2010 00:37  |
Eclipse User |
|
|
|
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?
|
|
|
Re: Constraints through Annotations in Ecore model [message #558567 is a reply to message #558454] |
Mon, 13 September 2010 10:06  |
Eclipse User |
|
|
|
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?
|
|
|
Powered by
FUDForum. Page generated in 0.03827 seconds