Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » validation order
validation order [message #1074986] Sun, 28 July 2013 10:46 Go to next message
Yueming Hong is currently offline Yueming HongFriend
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 11:08 Go to previous messageGo to next message
J A is currently offline J AFriend
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 11:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
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.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: validation order [message #1075071 is a reply to message #1074997] Sun, 28 July 2013 17:01 Go to previous messageGo to next message
Yueming Hong is currently offline Yueming HongFriend
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 17:09 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Auto edit strategy with ID's
Next Topic:Using multi line comments as elements of a DSL
Goto Forum:
  


Current Time: Thu Mar 28 12:10:04 GMT 2024

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

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

Back to the top