@Override public String[] unparse(LoadContext context, AbilityCategory ac) { DisplayLocation location = ac.getDisplayLocation(); if (location == null) { return null; } return new String[] {location.toString()}; }
@Override protected ParseResult parseNonEmptyToken(LoadContext context, AbilityCategory ac, String value) { /* * TODO This i18n is a bit challenging - in that it can create * incompatible datasets between those that are i18n enabled and those * that are not. Not sure whether in_Feat should be equivalent to Feat * (logic can argue either way). Need some consideration if data sets * should be i18n aware (AbilityCategory is currently the only object * that is, and I'm not sure we want the data to be i18n aware) - TP * * See also DiaplayNameToken and PluralToken (and how they are processed * in AbilityCategory) */ String loc; if (value.startsWith("in_")) { loc = LanguageBundle.getString(value); } else { loc = value; } ac.setDisplayLocation(DisplayLocation.getConstant(loc)); return ParseResult.SUCCESS; }