Class FlowableExpressionFormatUtils
- java.lang.Object
-
- com.flowable.platform.expressions.FlowableExpressionFormatUtils
-
public class FlowableExpressionFormatUtils extends java.lang.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 java.lang.String
formatCurrencyWithLocale(java.lang.String currencyCode, double amount, java.lang.String languageTag)
Formats a currency amount according to the format specified in the locale of the provided language tag.java.lang.String
formatDate(java.lang.Object dateObject, java.lang.String dateFormat)
Formats a Date, Instant, LocalDate or LocalDateTime to a String with the given Formatjava.lang.String
formatDecimal(java.lang.String pattern, double decimal)
Formats a String according to the Java Formatter specification with a Decimal Formatter in the default locale.java.lang.String
formatString(java.lang.String text, java.lang.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.htmljava.lang.String
formatStringWithLocale(java.lang.String languageTag, java.lang.String text, java.lang.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 java.lang.String formatString(java.lang.String text, java.lang.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 java.lang.String formatDate(java.lang.Object dateObject, java.lang.String dateFormat)
Formats a Date, Instant, LocalDate or LocalDateTime to a String with the given Format- Parameters:
dateObject
- Date, Instant, LocalDate or LocalDateTime to convertdateFormat
- Date Format to be used- Returns:
- Formatted date
-
formatDecimal
public java.lang.String formatDecimal(java.lang.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 java.lang.String formatStringWithLocale(java.lang.String languageTag, java.lang.String text, java.lang.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 java.lang.String formatCurrencyWithLocale(java.lang.String currencyCode, double amount, java.lang.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
-
-