Class FlowableExpressionFormatUtils
- java.lang.Object
-
- com.flowable.platform.expressions.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 Summary
Constructors Constructor Description FlowableExpressionFormatUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.String
formatDate(Object value, String dateFormat)
Formats the input to a String with the given format.String
formatDecimal(String pattern, double decimal)
Formats a String according to the Java Formatter specification with a Decimal Formatter in the default locale.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.htmlString
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.
-
-
-
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 formattedsubstitutes
- 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, nevernull
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 useddecimal
- 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 formattedsubstitutes
- 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 withlanguageTag
- The language to be used when formatting, e.g. "de-CH".amount
- The amount to be formatted- Returns:
- The formatted currency amount
-
-