/** * Joins all the object in the given iterable by concatenating all their String representation. * It invokes toString() an all the objects and concatening them using the default separator ", ". * Actually it handles also Maps, Arrays and Iterator by collecting their values. * Note that this method accepts an Object in order to be used in conjunction with the {@link Lambda#forEach(Iterable)}. * @param iterable The iterable containing the objects to be joined * @return The concatenation of the String representation of all the objects in the given iterable or an empty String if the iterable is null or empty */ public static String join(Object iterable) { return join(iterable, ", "); }
private String stringFormOf(Object fieldValue) { if (Iterable.class.isAssignableFrom(fieldValue.getClass())) { return "[" + join(fieldValue) + "]"; } else { return fieldValue.toString(); } }
private String stringFormOf(Object fieldValue) { if (Iterable.class.isAssignableFrom(fieldValue.getClass())) { return "[" + join(fieldValue) + "]"; } else { return fieldValue.toString(); } }
public String getFileContent(String fileName, String formGroupName) { String xformFilePath = join(asList(XFORMS_FOLDER, formGroupName, fileName), File.separator); try { return org.apache.commons.io.IOUtils.toString(getClass().getClassLoader().getResourceAsStream(xformFilePath)); } catch (Exception e) { throw new MotechException("Encountered error while loading openxdata forms", e); } } }
private static String mapDescription(Map<String, ? extends Object> map) { List<String> propertyTerms = new ArrayList<String>(); for (String key : map.keySet()) { propertyTerms.add(propertyValueOf(key, map.get(key).toString())); } return join(propertyTerms); }
private static String mapDescription(Map<String, ? extends Object> map) { List<String> propertyTerms = new ArrayList<String>(); for (String key : map.keySet()) { propertyTerms.add(propertyValueOf(key, map.get(key).toString())); } return join(propertyTerms); }
public String getMessage() { return "Errors:" + join(convert(formErrors, new Converter<FormError, String>() { @Override public String convert(FormError formError) { return formError.getParameter() + "=" + formError.getError(); } }), "\n"); } }
/** * Joins all the object in this iterable by concatenating all their String representation. * It invokes toString() an all the objects and concatening them using the default separator ", ". * @return The concatenation of the String representation of all the objects in the given iterable or an empty String if the iterable is null or empty */ public String join() { return Lambda.join(getInner()); }
/** * Joins all the object in this iterable by concatenating all their String representation. * It invokes toString() an all the objects and concatening them using the given separator. * Note that this method accepts an Object in order to be used in conjunction with the {@link Lambda#forEach(Iterable)}. * @param separator The String used to separe the item's String representation * @return The concatenation of the String representation of all the objects in the given iterable or an empty String if the iterable is null or empty */ public String join(String separator) { return Lambda.join(getInner(), separator); }
@Override public void describeTo(Description description) { description.appendText("a collection of dates containing "); List<String> dates = convert(expectedDates, toReadableForm()); description.appendText("[" + join(dates) + "]"); }
@Override public void describeTo(Description description) { description.appendText("a collection of dates containing "); List<String> dates = convert(expectedDates, toReadableForm()); description.appendText("[" + join(dates) + "]"); }
@Override public void describeTo(Description description) { description.appendText("a collection of dates containing "); List<String> dates = convert(expectedDates, toReadableForm()); description.appendText("[" + join(dates) + "]"); }
@Override public void describeTo(Description description) { description.appendText("a collection of dates containing "); List<String> dates = convert(expectedDates, toReadableForm()); description.appendText("[" + join(dates) + "]"); }
private static String asString(GenericType genericType) { if (genericType.getType() == GenericTypeEnum.COMPOSITE_TYPE) { return "<" + join(genericType.getCompositeValues()) + ">"; } return genericType.getValue(); }
private static String asString(GenericType genericType) { if (genericType.getType() == GenericTypeEnum.COMPOSITE_TYPE) { return "<" + join(genericType.getCompositeValues()) + ">"; } return genericType.getValue(); }
@Override public String toString() { if (!hasChildren()) { return description; } else { String childDescriptions = join(extract(children, on(TestStep.class).toString())); return description + " [" + childDescriptions + "]"; } }
@Override public String toString() { if (!hasChildren()) { return description; } else { String childDescriptions = join(extract(children, on(TestStep.class).toString())); return description + " [" + childDescriptions + "]"; } }
@Override public String toString() { return getTitle() + ":" + join(extract(testSteps, on(TestStep.class).toString())); }