Skip to content

Commit

Permalink
InputComponents.hasValue now checks if the value is an empty collection
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Sep 24, 2013
1 parent 042da1a commit da14948
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ else if (value instanceof String && value.toString().isEmpty())
{
ret = false;
}
else if (value instanceof Iterable && !((Iterable) value).iterator().hasNext())
{
ret = false;
}
else
{
ret = true;
Expand Down Expand Up @@ -305,13 +309,13 @@ public static String validateRequired(final InputComponent<?, ?> input)
* @return the item label converter of a {@link SelectComponent} or a {@link Converter} instance from the
* {@link ConverterFactory} parameter if not null
*/
public static Converter<?, String> getItemLabelConverter(final ConverterFactory converterFactory,
public static Converter<Object, String> getItemLabelConverter(final ConverterFactory converterFactory,
final SelectComponent<?, ?> input)
{
Converter<?, String> converter = input.getItemLabelConverter();
Converter<Object, String> converter = (Converter<Object, String>) input.getItemLabelConverter();
if (converter == null && converterFactory != null)
{
converter = converterFactory.getConverter(input.getValueType(), String.class);
converter = (Converter<Object, String>) converterFactory.getConverter(input.getValueType(), String.class);
}
return converter;
}
Expand Down

0 comments on commit da14948

Please sign in to comment.