Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Bind STRINGValueConverter
Bind STRINGValueConverter [message #1840525] Sat, 17 April 2021 18:37 Go to next message
M D is currently offline M DFriend
Messages: 23
Registered: January 2021
Junior Member
I'm creating my own version of the STRINGValueConverter, but I'm having trouble binding it.

public class UpdatedSTRINGValueConverter extends STRINGValueConverter {

@Override
public String toValue(String string, INode node) throws ValueConverterException {
if (string == null) return null;
return string.substring(5, string.length() - 3);
}

@Override
protected String toEscapedString(String value) {
return "START" + Strings.convertToJavaString(value, false) + "END";
}
}

I get an error in the RuntimeModule when trying to bind it:
@Override
public Class<? extends IValueConverterService> bindIValueConverterService() {
return UpdatedSTRINGValueConverter.class;
}
Re: Bind STRINGValueConverter [message #1840526 is a reply to message #1840525] Sat, 17 April 2021 18:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13930
Registered: July 2009
Senior Member
you need to bind STRINGValueConverter in this case

public Class<? extends STRINGValueConverter> bindSTRINGValueConverter() {
return UpdatedSTRINGValueConverter.class;
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Bind STRINGValueConverter [message #1840527 is a reply to message #1840526] Sat, 17 April 2021 19:25 Go to previous message
M D is currently offline M DFriend
Messages: 23
Registered: January 2021
Junior Member
Thanks!
Previous Topic:Missing Rule BEGIN in White-space awareness grammar
Next Topic:Formatter2 autowrap
Goto Forum:
  


Current Time: Sat May 08 23:40:07 GMT 2021

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

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

Back to the top