Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Using a customized XbaseValidator
Using a customized XbaseValidator [message #1768739] Sun, 23 July 2017 04:55 Go to next message
Eclipse UserFriend
Hello everyone,

I want to customize Xbase, so that assignments to parameters are possible.
I already customized the JvmModelGenerator to generate the appropriate code and it works.
But I also need to customize the validation of Xbase.
I did subclass the XbaseValidator and customized the checkAssignment method.
My problem is: How do i inject my customized XbaseValidator instead of the original one?

I already subclassed and customized th XbaseRuntimeModule:
class BpoXbaseRuntimeModule extends XbaseRuntimeModule {
	
	@SingletonBinding(eager=true)
	override Class<? extends XbaseValidator> bindXbaseValidator() {
		return BpoXbaseValidator;
	}
	
}


and the XbaseStandaloneSetup:
class BpoXbaseStandaloneSetup extends XbaseStandaloneSetup{
	override Injector createInjector() {
		return Guice.createInjector(new BpoXbaseRuntimeModule());
	}
	
	def static void doSetup() {
		new BpoXbaseStandaloneSetup().createInjectorAndDoEMFRegistration()
	}
}


But my validator is not injected during runtime.
Do I have to customize another part?
How does the runtime know wich StandaloneSetup to use?

Thanks in advance and best regards,
Marco

[Updated on: Sun, 23 July 2017 04:56] by Moderator

Re: Customizing assignement to parameters in Xbase [message #1768740 is a reply to message #1768739] Sun, 23 July 2017 04:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi

You should add the bindings to the pregenerated runtimemodule.
You should override the bindYourdslValidator method
Re: Customizing assignement to parameters in Xbase [message #1768742 is a reply to message #1768740] Sun, 23 July 2017 05:48 Go to previous message
Eclipse UserFriend
Oh, it seems i over complicated things...
Overriding the checkAssignment-Method in the default- Validator did the trick, hence it inherits from XbaseValidator.
Thank you for setting me back on track Christian!

Have a nice day! :)
Previous Topic:Github Pull Requests
Next Topic:Unable to resolve some references in .mwe2 file
Goto Forum:
  


Current Time: Wed Jul 23 23:19:28 EDT 2025

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

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

Back to the top