/** * generate parameters from the "ITEM_DATA" of a "web_submit_data" * @param extractPart the extract containing only the "ITEM_DATA" of the "web_submit_data" */ @VisibleForTesting public static List<Parameter> buildPostParamsFromExtract(List<String> extractPart) { List<Item> items = MethodUtils.parseItemList(extractPart); return items.stream() .filter(item -> item.getAttribute("Name").isPresent()) .<Parameter>map(item -> ImmutableParameter.builder().name(item.getAttribute("Name").get()).value(item.getAttribute("Value")).build()) .collect(Collectors.toList()); }
/** * Fill a builder with attribute values from the provided {@code Parameter} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(Parameter instance) { Objects.requireNonNull(instance, "instance"); name(instance.getName()); Optional<String> valueOptional = instance.getValue(); if (valueOptional.isPresent()) { value(valueOptional); } return this; }