org.jboss.forge.addon.convert.Converter<Object, String> itemLabelConverter = InputComponents .getItemLabelConverter(converterFactory, (SelectComponent) input); Iterable<?> valueChoices = ((SelectComponent<?, ?>) input).getValueChoices();
/** * * Returns the item label converter, that is * * @param converterFactory May be null * @param 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 <IMPLTYPE, VALUETYPE> Converter<VALUETYPE, String> getItemLabelConverter( final ConverterFactory converterFactory, final SelectComponent<IMPLTYPE, VALUETYPE> input) { Converter<VALUETYPE, String> converter = input.getItemLabelConverter(); if (converter == null && converterFactory != null) { converter = converterFactory.getConverter(input.getValueType(), String.class); } return converter; }
return select.hasDefaultValue() ? select.getValue() : null; String description = select.getDescription(); if (!Strings.isNullOrEmpty(description)) Converter<Object, String> itemLabelConverter = InputComponents.getItemLabelConverter(converterFactory, select); List<Object> items = Lists.toList(select.getValueChoices()); if (items.size() > 0) String limit = items.size() == 1 ? "" : "-" + (items.size() - 1); String message = label + description + " [0" + limit + "]"; idx = Integer.parseInt(promptInternal(message, true, select.isRequired()));
if (input instanceof SelectComponent) { SelectComponent selectComponent = (SelectComponent) input; Iterable valueChoices = selectComponent.getValueChoices(); Converter converter = selectComponent.getItemLabelConverter(); for (Object valueChoice : valueChoices) { Object jsonValue = convertValueToSafeJson(converter, valueChoice);
value = promptSelectComponent(select, Collections.singleton(select.getValue()));
if (input instanceof SelectComponent) { SelectComponent selectComponent = (SelectComponent) input; Iterable valueChoices = selectComponent.getValueChoices(); Converter converter = selectComponent.getItemLabelConverter();
Converter<Object, String> itemLabelConverter = InputComponents .getItemLabelConverter(converterFactory, selectComponent); Iterable<Object> valueChoices = selectComponent.getValueChoices(); List<String> choices = new ArrayList<>(); for (Object choice : valueChoices)
Iterable<?> valueChoices = ((SelectComponent) input).getValueChoices(); Converter itemLabelConverter = InputComponents.getItemLabelConverter(converterFactory, ((SelectComponent) input));
inputConverter = InputComponents.getItemLabelConverter(converterFactory, selectComponent); JsonArrayBuilder valueChoices = createArrayBuilder(); for (Object valueChoice : selectComponent.getValueChoices())
Iterable<Object> valueChoices = selectComponent.getValueChoices(); final Converter<Object, ?> selectConverter; if (String.class.isAssignableFrom(sourceType)) Set<Object> valueChoices = Sets.toSet(selectComponent.getValueChoices());