Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » validation order
validation order [message #1074986] Sun, 28 July 2013 06:46 Go to next message
Yueming Hong is currently offline Yueming Hong
Messages: 87
Registered: April 2013
Member
Hi friends,

Is there a way to customize the order to validation?

By default, the validator check the model then the rest elements one by one.
How can i skip one element and check it at the end of file?

For instance,
element 1
element 2
element 3
element 4

The checking order is customized to
element 1
element 3
element 4
element 2

Thanks
Re: validation order [message #1074992 is a reply to message #1074986] Sun, 28 July 2013 07:08 Go to previous messageGo to next message
J A is currently offline J A
Messages: 31
Registered: July 2013
Member
I know of only one way: use a checker to call the methods used to check each element, one by one.

@Check
public void checkByOrder(YourModel model){

  // Traverse your AST to go to element 1
  checkElement1();
  // Traverse your AST to go to element 2
  checkElement2();
  ...

}
Re: validation order [message #1074997 is a reply to message #1074992] Sun, 28 July 2013 07:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6213
Registered: July 2009
Senior Member
yes this is an option to define the check rule for the root/parent.
btw why do you want to check in a specific order.
the validator should be stateless.
Re: validation order [message #1075071 is a reply to message #1074997] Sun, 28 July 2013 13:01 Go to previous messageGo to next message
Yueming Hong is currently offline Yueming Hong
Messages: 87
Registered: April 2013
Member
Hi, yes, this way works.
Eh, there is a late-reference which only evaluate at the end of the file.
Re: validation order [message #1075073 is a reply to message #1075071] Sun, 28 July 2013 13:09 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6213
Registered: July 2009
Senior Member
Hi I don't get it. You can use @Check(CheckType.Normal)
If you want the check to be executed on save only

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Previous Topic:Nested Struct with Qualified Name
Next Topic:Using multi line comments as elements of a DSL
Goto Forum:
  


Current Time: Fri Aug 22 21:40:05 EDT 2014

Powered by FUDForum. Page generated in 0.40505 seconds