VaadinUtils { public static BigDecimal stringToBigDecimal(boolean percentage, boolean useGrouping, boolean currency, int precision, String value, Locale locale) { BigDecimalConverter converter = ConverterFactory.createBigDecimalConverter(currency, percentage, useGrouping, precision, VaadinUtils.getCurrencySymbol()); return converter.convertToModel(value, new ValueContext(locale)).getOrThrow(r -> new OCSRuntimeException()); } private  VaadinUtils(); static String bigDecimalToString(boolean percentage, boolean useGrouping, BigDecimal value); static String bigDecimalToString(boolean currency, boolean percentage, boolean useGrouping,
			BigDecimal value); static String bigDecimalToString(boolean currency, boolean percentage, boolean useGrouping, int precision,
			BigDecimal value, Locale locale); static String bigDecimalToString(boolean currency, boolean percentage, boolean useGrouping, int precision,
			BigDecimal value, Locale locale, String currencySymbol); static Image createImage(String imageName); static String doubleToString(boolean currency, boolean percentage, boolean useGrouping, int precision,
			Double value, Locale locale); static String doubleToString(boolean currency, boolean percentage, boolean useGrouping, int precision,
			Double value, Locale locale, String currencySymbol); static String getCurrencySymbol(); static Locale getDateLocale(); @SuppressWarnings("unchecked") static T getFirstChildOfClass(Component component, Class<T> clazz); static String getFirstValueFromCollection(Map<String, Object> map, String key); static Object getFromSession(String name); static Locale getLocale(); @SuppressWarnings("unchecked") static T getParentOfClass(Component component, Class<T> clazz); @SuppressWarnings("unchecked") static String getSessionAttributeValueFromMap(String attributeName, String key); static String integerToString(boolean grouping, boolean percentage, Integer value); static String integerToString(boolean grouping, boolean percentage, Integer value, Locale locale); static String longToString(boolean grouping, boolean percentage, Long value); static String longToString(boolean grouping, boolean percentage, Long value, Locale locale); static String numberToString(AttributeModel am, T value, boolean grouping, Locale locale,
			String currencySymbol); static void removeFromSession(String name); static void setLabel(Component component, String label); static void setPlaceHolder(Component component, String placeHolder); static void setTooltip(Component component, String tooltip); static void showConfirmDialog(String question, Runnable whenConfirmed); static void showConfirmDialog(String question, Runnable whenConfirmed, Runnable whenCanceled); static void showErrorNotification(String message); static void showNotification(String message, Position position, NotificationVariant variant); static void showTrayNotification(String message); static void storeDateLocale(Locale locale); static void storeInSession(String name, Object value); static void storeLocale(Locale locale); static BigDecimal stringToBigDecimal(boolean percentage, boolean useGrouping, boolean currency,
			int precision, String value, Locale locale); static BigDecimal stringToBigDecimal(boolean percentage, boolean useGrouping, boolean currency,
			String value); static Double stringToDouble(boolean percentage, boolean useGrouping, boolean currency, int precision,
			String value, Locale locale); static Integer stringToInteger(boolean grouping, String value); static Integer stringToInteger(boolean grouping, String value, Locale locale); static Long stringToLong(boolean grouping, String value); static Long stringToLong(boolean grouping, String value, Locale locale); static VerticalLayout createOverflowLayout(String height);  }
@Test public void testStringToBigDecimal() { assertEquals(1234.34, VaadinUtils.stringToBigDecimal(false, false, false, "1234,341").doubleValue(), 0.001); assertEquals(1234.34, VaadinUtils.stringToBigDecimal(false, false, false, 2, "1234,34", LOCALE).doubleValue(), 0.001); assertEquals(1234.3415, VaadinUtils.stringToBigDecimal(false, false, false, 4, "1234,3415", LOCALE).doubleValue(), 0.001); assertEquals(1234, VaadinUtils.stringToBigDecimal(false, true, false, 2, "1.234", LOCALE).doubleValue(), 0.001); assertEquals(1234, VaadinUtils.stringToBigDecimal(true, true, false, 2, "1.234%", LOCALE).doubleValue(), 0.001); assertEquals(1234, VaadinUtils.stringToBigDecimal(false, true, true, 2, "€ 1.234", LOCALE).doubleValue(), 0.001); }