public final class DefaultValueLabelService extends ValueLabelService
{
@Override
public String provide( final String text )
{
final ValueProperty property = context( ValueProperty.class );
final String decoded = property.decodeKeywords( text );
String label = decoded;
final ValueKeyword keyword = property.getKeyword( property.encodeKeywords( decoded ) );
if( keyword != null )
{
label = keyword.toDisplayString();
}
else if( property.hasAnnotation( NamedValues.class ) )
{
final LocalizationService localization = property.getLocalizationService();
for( final NamedValue x : property.getAnnotation( NamedValues.class ).namedValues() )
{
if( decoded.equals( x.value() ) )
{
label = localization.text( x.label(), CapitalizationType.NO_CAPS, false ) + " (" + x.value() + ")";
break;