Class JKFormatUtil

java.lang.Object
com.jk.core.util.JKFormatUtil

public class JKFormatUtil extends Object
This class is a utility class used for formatting various types of data, such as dates, times, numbers, and more.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Field Details

    • DEFAULT_DATE_PATTERN

      public static final String DEFAULT_DATE_PATTERN
      Represents the default format of date.
      See Also:
    • DEFAULT_TIME_PATTERN

      public static final String DEFAULT_TIME_PATTERN
      Represents the default format of time.
      See Also:
    • DEFAULT_TIMESTAMP_PATTERN

      public static final String DEFAULT_TIMESTAMP_PATTERN
      Represents the default format for time stamp.
      See Also:
    • DEFAULT_DOUBLE_FORMAT

      public static final String DEFAULT_DOUBLE_FORMAT
      Represents the default format for double values.
      See Also:
    • DEFAULT_NUMBER_FORMAT

      public static final String DEFAULT_NUMBER_FORMAT
      Represents the default format for numbers.
      See Also:
    • MYSQL_DATE_DB_PATTERN

      public static final String MYSQL_DATE_DB_PATTERN
      Represents the default format for database date.
      See Also:
    • formatMap

      public static Map<String,Format> formatMap
      This map is used to store format instances for various patterns.
  • Constructor Details

    • JKFormatUtil

      public JKFormatUtil()
  • Method Details

    • format

      public static String format(Object object, String pattern)
      This method formats the given object using the specified pattern.
      Parameters:
      object - Specifies the object to be formatted.
      pattern - Specifies the formatting pattern to be applied.
      Returns:
      the formatted string representation of the object.
    • formatDate

      public static String formatDate(Date object, String pattern)
      This method formats a Date object using the provided pattern.
      Parameters:
      object - Specifies the object to be formatted.
      pattern - Specifies the formatting pattern to be applied.
      Returns:
      the formatted date string.
    • formatDouble

      public static String formatDouble(Double amount, String pattern)
      This method formats a Double value using the provided pattern.
      Parameters:
      amount - Specifies the Double value to be formatted.
      pattern - Specifies the formatting pattern to be applied.
      Returns:
      the formatted Double value string.
    • formatTime

      public static String formatTime(Time object, String pattern)
      This method formats a Time object using the provided pattern.
      Parameters:
      object - Specifies the object to be formatted.
      pattern - Specifies the formatting pattern to be applied.
      Returns:
      the formatted time string.
    • formatTimeStamp

      public static String formatTimeStamp(Timestamp date, String pattern)
      This method formats a Timestamp object using the provided pattern.
      Parameters:
      date - Specifies the object to be formatted.
      pattern - Specifies the formatting pattern to be applied.
      Returns:
      the formatted time stamp string.
    • getDateFormatter

      public static Format getDateFormatter(String pattern)
      This method retrieves a Format instance for the specified date pattern.
      Parameters:
      pattern - Specifies the date pattern.
      Returns:
      the Format instance for the pattern.
    • getNumberFormatter

      public static Format getNumberFormatter(String pattern)
      This method retrieves a Format instance for the specified number pattern.
      Parameters:
      pattern - Specifies the number pattern.
      Returns:
      the Format instance for the pattern.
    • formatNumber

      public static String formatNumber(Number count)
      This method formats a number using the default number format pattern.
      Parameters:
      count - Specifies the number to be formatted.
      Returns:
      the formatted number string.
    • formatDate

      public static String formatDate(Date date)
      This method formats a date using the default date format pattern.
      Parameters:
      date - Specifies the date to be formatted.
      Returns:
      the formatted date string.
    • formatTime

      public static String formatTime(Time time)
      This method formats time using the default time format pattern.
      Parameters:
      time - Specifies the time to be formatted.
      Returns:
      the formatted time string.
    • capitalizeFirstLetters

      public static String capitalizeFirstLetters(String text)
      This method capitalizes the first letters of a given text.
      Parameters:
      text - Specifies the text to be capitalized.
      Returns:
      the text with first letters capitalized.
    • formatAmount

      public static String formatAmount()
      This method is yet to be implemented (TBI).
      Returns:
      null.
    • formatMark

      public static String formatMark(float mark)
      This method is yet to be implemented (TBI).
      Parameters:
      mark - Specifies the parameter for this method (TBI).
      Returns:
      null.
    • formatAmount

      public static Object formatAmount(double studySemesterPaymentsAmount)
      This method is yet to be implemented (TBI).
      Parameters:
      studySemesterPaymentsAmount - Specifies the parameter for this method (TBI).
      Returns:
      null.