I am trying to escape a keyword and I read from several google results that if I register a value converter for my qualified name rule it will do it automatically, but its not working for me.
This is my grammar
grammar com.fluxtah.example.sharedprefs.SharedPreferencesModel with org.eclipse.xtext.common.Terminals
generate sharedPreferencesModel "url goes here"
Model:
'package' packageName=FQN
preferencesBlock=PreferencesBlock;
PreferencesBlock:
'preferences' name=ID '{' (prefs+=Preference)* '}';
Preference:
name=ID ':' type=PreferenceType
;
enum PreferenceType:
String='String' |
Integer='int' |
Boolean='boolean' |
Float='float' |
Long='long'
;
FQN:
ID (=>'.' ID)*;
And this is my module config:
public class SharedPreferencesModelRuntimeModule extends com.fluxtah.example.sharedprefs.AbstractSharedPreferencesModelRuntimeModule {
@Override
public Class<? extends IValueConverterService> bindIValueConverterService() {
return ValueConverters.class;
}
}
And here is my value converter:
public class ValueConverters extends DefaultTerminalConverters {
@Inject QualifiedNameValueConverter mFQNValueConverter;
@ValueConverter(rule = "FQN")
public IValueConverter<String> FQN() {
return mFQNValueConverter;
}
}
And my model:
package com.fluxtah.example.preferences.qux
preferences DashUser {
IsAuthenticated:boolean
LoginNamespace:String
LoginPassword:String
LoginUsername:String
}
But the package declaration still shows an error so I guess I have missed something fundamental in my understanding of value converters?
Really appreciate if someone could help me.
[Updated on: Fri, 27 July 2012 07:40]
Report message to a moderator