Class PresentationStringConverter

java.lang.Object
hu.rts.mike.example.dev.crm.converter.PresentationStringConverter

@Component public class PresentationStringConverter extends Object
  • Constructor Details

    • PresentationStringConverter

      public PresentationStringConverter()
  • Method Details

    • getDecimalFormat

      public DecimalFormat getDecimalFormat()
      Gets a DecimalFormat instance based on the current Locale.
      Returns:
      The DecimalFormat instance with the proper symbols for the current Locale.
    • getDateFormatter

      public DateTimeFormatter getDateFormatter()
      Gets a DateTimeFormatter instance for formatting dates based on the current Locale.
      Returns:
      The DateTimeFormatter instance with the appropriate date format pattern for the current Locale.
    • getDateTimeFormatter

      public DateTimeFormatter getDateTimeFormatter()
      Gets a DateTimeFormatter instance for formatting date-time values based on the current Locale.
      Returns:
      The DateTimeFormatter instance with the appropriate date-time format pattern for the current Locale.
    • getDateFormatPattern

      public String getDateFormatPattern()
      Gets the date format pattern (pattern for formatting dates) for the current Locale.
      Returns:
      The date format pattern as a string for the current Locale.
    • getDateTimeFormatPattern

      public String getDateTimeFormatPattern()
      Gets the date-time format pattern (pattern for formatting date-time values) for the current Locale.
      Returns:
      The date-time format pattern as a string for the current Locale.
    • fromDateLocalized

      public String fromDateLocalized(LocalDate value)
      Converts a LocalDate to a localized string representation using the current Locale.
      Parameters:
      value - The LocalDate value to be converted to a string.
      Returns:
      The localized string representation of the provided LocalDate, or "-" if the value is null.
    • fromDateTimeLocalized

      public String fromDateTimeLocalized(Instant value)
      Converts an Instant value to a localized string representation of date-time using the current Locale and time zone offset (in seconds).
      Parameters:
      value - The Instant value to be converted to a string.
      Returns:
      The localized string representation of the provided Instant, or "-" if the value is null.
    • fromDoubleDecimal

      public String fromDoubleDecimal(Double value)
      Converts a Double value to a localized string representation using the current Locale.
      Parameters:
      value - The Double value to be converted to a string.
      Returns:
      The localized string representation of the provided Double, or "-" if the value is null.
    • fromInteger

      public String fromInteger(Integer value)
      Converts an Integer value to a string representation.
      Parameters:
      value - The Integer value to be converted to a string.
      Returns:
      The string representation of the provided Integer, or "-" if the value is null.
    • nullSafeString

      public String nullSafeString(Object value)
      Returns a non-null string value or a default "-" string if the provided value is null.
      Parameters:
      value - The object value to be checked for null.
      Returns:
      String value of the provided object if not null, or "-" if the value is null.
    • concatWithAffixes

      public String concatWithAffixes(String prefix, String value, String suffix)
      Returns:
      a string which concatenates the given value with prefix and suffix. If the value is null, empty or "-" it returns an empty string.
    • concatWithPrefix

      public String concatWithPrefix(String prefix, String value)
      Returns:
      a string which concatenates the given value with prefix. If the value is null, empty or "-" it returns an empty string.
    • concatWithSuffix

      public String concatWithSuffix(String value, String suffix)
      Returns:
      a string which concatenates the given value with suffix. If the value is null, empty or "-" it returns an empty string.