if (input instanceof SelectComponent)
{
result.append(" Valid choices: [");
Iterable<?> valueChoices = ((SelectComponent) input).getValueChoices();
Converter itemLabelConverter = ((SelectComponent) input).getItemLabelConverter();
for (Object choice : valueChoices)
{
if (choice != null)
{
Object itemLabel = choice.toString();
if (itemLabelConverter != null)
itemLabel = itemLabelConverter.convert(choice);
result.append("\"" + itemLabel + "\" ");
}
}
result.append("] ");
if (input.hasDefaultValue() && input.hasValue())
{
result.append(" defaults to: [");
if (input instanceof ManyValued)
{
Iterable values = ((ManyValued) input).getValue();
if (values.iterator().hasNext())
{
for (Object value : values)
{
if (value != null)
{
Object itemLabel = value.toString();
if (itemLabelConverter != null)
itemLabel = itemLabelConverter.convert(value);
result.append("\"" + itemLabel + "\" ");
}
}
}
else
{
Object value = input.getValue();
if (value != null)
{
Object itemLabel = value.toString();
if (itemLabelConverter != null)
itemLabel = itemLabelConverter.convert(value);
result.append("\"" + itemLabel + "\" ");
}
}
}
result.append("]");