Class QValueFormatter

java.lang.Object
com.kingsrook.qqq.backend.core.actions.values.QValueFormatter

public class QValueFormatter extends Object
Utility to apply display formats to values for records and fields.
  • Constructor Details

    • QValueFormatter

      public QValueFormatter()
  • Method Details

    • formatValue

      public static String formatValue(QFieldMetaData field, Serializable value)
      For a field, and its value, apply the field's displayFormat.
    • formatValue

      public static String formatValue(String displayFormat, Serializable value)
      For a display format string (e.g., %d), and a value, apply the displayFormat.
    • formatDate

      public static String formatDate(LocalDate date)
    • formatDateTime

      public static String formatDateTime(LocalDateTime dateTime)
    • formatDateTimeWithZone

      public static String formatDateTimeWithZone(ZonedDateTime dateTime)
    • formatLocalTime

      public static String formatLocalTime(LocalTime localTime)
    • formatRecordLabel

      public static String formatRecordLabel(QTableMetaData table, QRecord record)
      Make a string from a table's recordLabelFormat and fields, for a given record.
    • formatStringWithValues

      public static String formatStringWithValues(String formatString, List<String> formatValues)
      For a given format string, and a list of values, apply the format. Note, null values in the list become "".
    • setDisplayValuesInRecords

      public static void setDisplayValuesInRecords(QTableMetaData table, List<QRecord> records)
      For a list of records, set their recordLabels and display values - including record label (e.g., from the table meta data).
    • setDisplayValuesInRecords

      public static void setDisplayValuesInRecords(QTableMetaData table, Map<String,QFieldMetaData> fields, List<QRecord> records)
      For a list of records, set their recordLabels and display values
    • setDisplayValuesInRecord

      public static void setDisplayValuesInRecord(QTableMetaData table, Map<String,QFieldMetaData> fields, QRecord record)
      For a single record, set its display values - public version of this.
    • formatBoolean

      public static String formatBoolean(Boolean b)
    • setBlobValuesToDownloadUrls

      public static void setBlobValuesToDownloadUrls(QTableMetaData table, List<QRecord> records)
      For any BLOB type fields in the list of records, change their value to the URL where they can be downloaded, and set their display value to a file name.