Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Constraints through Annotations in Ecore model(Invoking the constraints which are added through annotations in Ecore model)
Constraints through Annotations in Ecore model [message #558454] Mon, 13 September 2010 04:37 Go to next message
Animesh Kumar is currently offline Animesh KumarFriend
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 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
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/
Previous Topic:Current EMF update sites?
Next Topic:Using EMF in a standalone application / Birt Project - IncompatibleClassChangeError
Goto Forum:
  


Current Time: Fri Apr 19 20:17:02 GMT 2024

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

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

Back to the top