use of com.robotoworks.mechanoid.sharedprefs.sharedPreferencesModel.BooleanLiteral in project mechanoid by robotoworks.
the class SharedPreferencesModelJavaValidator method checkDefaultValue.
@Check
public void checkDefaultValue(Preference preference) {
PreferenceType type = preference.getType();
Literal defaultValue = preference.getDefaultValue();
if (defaultValue == null) {
return;
}
switch(type) {
case STRING:
if (!(defaultValue instanceof StringLiteral)) {
error("Type mismatch", SharedPreferencesModelPackage.Literals.PREFERENCE__DEFAULT_VALUE);
}
break;
case BOOLEAN:
if (!(defaultValue instanceof BooleanLiteral)) {
error("Type mismatch", SharedPreferencesModelPackage.Literals.PREFERENCE__DEFAULT_VALUE);
}
break;
case FLOAT:
case INTEGER:
case LONG:
if (!(defaultValue instanceof NumericLiteral)) {
error("Type mismatch", SharedPreferencesModelPackage.Literals.PREFERENCE__DEFAULT_VALUE);
}
break;
}
}
Aggregations