/** * Get localized value of an attribute based on {@link com.haulmont.cuba.core.entity.annotation.LocalizedValue} annotation. * * @param attribute attribute name * @param instance entity instance * @return localized value or the value itself, if the value is null or the message pack can not be inferred */ @Nullable public String getLocValue(String attribute, Instance instance) { String value = instance.getValue(attribute); if (value == null) return null; String mp = inferMessagePack(attribute, instance); if (mp == null) return value; else return messages.getMessage(mp, value); }
String mp = messageTools.inferMessagePack(name, entity); if (mp != null) attr.setMessagesPack(mp);