Skip to content

Commit

Permalink
FORGE-2493: No need to convert when target is assignable from source
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Oct 1, 2015
1 parent 9b9c1a8 commit 194159d
Showing 1 changed file with 1 addition and 11 deletions.
Expand Up @@ -248,22 +248,12 @@ public static Object convertToUIInputValue(final ConverterFactory converterFacto
{
SelectComponent<?, Object> selectComponent = (SelectComponent<?, Object>) input;
Iterable<Object> valueChoices = selectComponent.getValueChoices();
final Converter<Object, ?> selectConverter;
if (String.class.isAssignableFrom(sourceType))
{
selectConverter = getItemLabelConverter(converterFactory, selectComponent);
}
else
{
selectConverter = converterFactory.getConverter(targetType, sourceType);
}
Object chosenObj = null;
if (valueChoices != null)
{
for (Object valueChoice : valueChoices)
{
Object convertedObj = selectConverter.convert(valueChoice);
if (convertedObj.equals(value))
if (valueChoice.equals(value))
{
chosenObj = valueChoice;
break;
Expand Down

0 comments on commit 194159d

Please sign in to comment.