Inheriting from Java based validator fails due to changed naming [message #1755539] |
Sun, 05 March 2017 05:58  |
Eclipse User |
|
|
|
Hi all,
I have a DSL which inherits from another thirdparty language. I also want my validator to inherit from that language one's. However, the thirdparty validator I want to inherit from is named "[DslName]JavaValidator " which causes compilation problems because the generated code tries to inherit from "[DslName]Validator" (note the missing 'Java').
Is there any way to configure the MWE workflow to compute the old naming?
My solution would be to bind a custom ValidatorNaming implementation, but this has the drawback that my own validator, which is intended to be Xtend based, also gets the 'Java' part into its class name.
class MyDslWorkflowLanguage extends StandardLanguage {
override getGuiceModule() {
Modules.override(super.getGuiceModule()).with(new Module() {
override configure(Binder binder) {
binder.bind(ValidatorNaming).to(OldValidatorNaming)
}
})
}
}
class OldValidatorNaming extends ValidatorNaming {
@Inject extension XtextGeneratorNaming
override getValidatorClass(Grammar grammar) {
val runtimeBasePackage = grammar.runtimeBasePackage + ".validation."
val simpleName = grammar.simpleName
val name = runtimeBasePackage + simpleName + "JavaValidator"
return new TypeReference(name)
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24975 seconds