Package com.jk.core.util
Class JKFormatUtil
java.lang.Object
com.jk.core.util.JKFormatUtil
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Represents the default format of date.static final String
Represents the default format for double values.static final String
Represents the default format for numbers.static final String
Represents the default format of time.static final String
Represents the default format for time stamp.This map is used to store format instances for various patterns.static final String
Represents the default format for database date. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
capitalizeFirstLetters
(String text) This method capitalizes the first letters of a given text.static String
This method formats the given object using the specified pattern.static String
This method is yet to be implemented (TBI).static Object
formatAmount
(double studySemesterPaymentsAmount) This method is yet to be implemented (TBI).static String
formatDate
(Date date) This method formats a date using the default date format pattern.static String
formatDate
(Date object, String pattern) This method formats aDate
object using the provided pattern.static String
formatDouble
(Double amount, String pattern) This method formats a Double value using the provided pattern.static String
formatMark
(float mark) This method is yet to be implemented (TBI).static String
formatNumber
(Number count) This method formats a number using the default number format pattern.static String
formatTime
(Time time) This method formats time using the default time format pattern.static String
formatTime
(Time object, String pattern) This method formats aTime
object using the provided pattern.static String
formatTimeStamp
(Timestamp date, String pattern) This method formats aTimestamp
object using the provided pattern.static Format
getDateFormatter
(String pattern) This method retrieves a Format instance for the specified date pattern.static Format
getNumberFormatter
(String pattern) This method retrieves a Format instance for the specified number pattern.
-
Field Details
-
DEFAULT_DATE_PATTERN
Represents the default format of date.- See Also:
-
DEFAULT_TIME_PATTERN
Represents the default format of time.- See Also:
-
DEFAULT_TIMESTAMP_PATTERN
Represents the default format for time stamp.- See Also:
-
DEFAULT_DOUBLE_FORMAT
Represents the default format for double values.- See Also:
-
DEFAULT_NUMBER_FORMAT
Represents the default format for numbers.- See Also:
-
MYSQL_DATE_DB_PATTERN
Represents the default format for database date.- See Also:
-
formatMap
This map is used to store format instances for various patterns.
-
-
Constructor Details
-
JKFormatUtil
public JKFormatUtil()
-
-
Method Details
-
format
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
This method formats aDate
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
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
This method formats aTime
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
This method formats aTimestamp
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
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
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
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
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
This method formats time using the default time format pattern.- Parameters:
time
- Specifies the time to be formatted.- Returns:
- the formatted time string.
-
capitalizeFirstLetters
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
This method is yet to be implemented (TBI).- Returns:
null
.
-
formatMark
This method is yet to be implemented (TBI).- Parameters:
mark
- Specifies the parameter for this method (TBI).- Returns:
null
.
-
formatAmount
This method is yet to be implemented (TBI).- Parameters:
studySemesterPaymentsAmount
- Specifies the parameter for this method (TBI).- Returns:
null
.
-