Class FlowableExpressionFormatUtils


  • public class FlowableExpressionFormatUtils
    extends Object
    Expression Bean Name: flwFormatUtils Offers a number of formatting utils, mostly related to numbers, currencies and strings. All methods which accept a language tag must be supplied with a string consisting of the language code and the country, e.g. "ch-DE", "en-US" etc.
    • Constructor Detail

      • FlowableExpressionFormatUtils

        public FlowableExpressionFormatUtils()
    • Method Detail

      • formatString

        public String formatString​(String text,
                                   Object... substitutes)
        Formats a String according to the Java Formatter specification, see https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html or https://docs.oracle.com/javase/tutorial/java/data/numberformat.html
        Parameters:
        text - String to be formatted
        substitutes - Objects to be replaced
        Returns:
        Text where all placeholders have been replaced
      • formatDate

        public String formatDate​(Object value,
                                 String dateFormat)
        Formats the input to a String with the given format. Supported inputs are:
        • Date
        • Instant
        • LocalDate
        • LocalDateTime
        • ISO 8601 String
        Parameters:
        value - the input to convert, never null
        dateFormat - the date format to be used
        Returns:
        the formatted date
      • formatDecimal

        public String formatDecimal​(String pattern,
                                    double decimal)
        Formats a String according to the Java Formatter specification with a Decimal Formatter in the default locale. See https://docs.oracle.com/javase/tutorial/java/data/numberformat.html
        Parameters:
        pattern - Decimal Pattern to be used
        decimal - Decimal to be formatted
        Returns:
        Text where all placeholders have been replaced
      • formatStringWithLocale

        public String formatStringWithLocale​(String languageTag,
                                             String text,
                                             Object... substitutes)
        Formats a String according to the Java Formatter specification, see https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html or https://docs.oracle.com/javase/tutorial/java/data/numberformat.html. The string is formatted according to the format specified in the locale of the provided language tag.
        Parameters:
        languageTag - The language to be used when formatting, e.g. "de-CH"
        text - The text to be formatted
        substitutes - The substitutes in the order of their appearance.
        Returns:
        Text where all placeholders have been replaced
      • formatCurrencyWithLocale

        public String formatCurrencyWithLocale​(String currencyCode,
                                               double amount,
                                               String languageTag)
        Formats a currency amount according to the format specified in the locale of the provided language tag.
        Parameters:
        currencyCode - The currency ot be formatted with
        languageTag - The language to be used when formatting, e.g. "de-CH".
        amount - The amount to be formatted
        Returns:
        The formatted currency amount