}
}
if (input instanceof SelectComponent)
{
SelectComponent selectComponent = (SelectComponent) input;
Class<?> valueType = input.getValueType();
Iterable<?> choices = null;
// Auto-populate Enums on SelectComponents
if (valueType.isEnum())
{
Class<? extends Enum> enumClass = valueType.asSubclass(Enum.class);
choices = EnumSet.allOf(enumClass);
}
// Auto-populate Exported values on SelectComponents
else if (Annotations.isAnnotationPresent(valueType, Exported.class))
{
List<Object> choiceList = new ArrayList<Object>();
for (ExportedInstance exportedInstance : addonRegistry.getExportedInstances(valueType))
{
Object instance = exportedInstance.get();
choiceList.add(instance);
exportedInstance.release(instance);
}
choices = choiceList;
}
selectComponent.setValueChoices(choices);
}
}