Package com.jk.core.util
Class JKConversionUtil
java.lang.Object
com.jk.core.util.JKConversionUtil
This class is a utility class used for performing various types of
conversions.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
This method converts an object to a boolean value withfalse
as default value.static boolean
This method converts an object to a boolean value, with a default value if conversion is not possible.static Date
This method converts an object to a Date value with a default value ofnull
.static Date
This method converts an object to a date value, with a default value if conversion is not possible.static double
This method converts an object to a double value with a default value of 0.static double
This method converts an object to a double value, with a default value if conversion is not possible.static float
This method converts an object to a float value.static Integer
This method converts an object to a integer value with a default value of 0.static int
This method converts an object to a integer value, with a default value if conversion is not possible.static long
This method converts an object to a long value with a default value of 0.static long
This method converts an object to a long value, with a default value if conversion is not possible.static String
This method converts an object to a string value.static Time
This method converts an object to a Time value.
-
Constructor Details
-
JKConversionUtil
public JKConversionUtil()
-
-
Method Details
-
toBoolean
This method converts an object to a boolean value withfalse
as default value.- Parameters:
value
- Specifies the value to be converted.- Returns:
- the converted boolean value.
-
toDate
This method converts an object to a Date value with a default value ofnull
.- Parameters:
value
- Specifies the value to be converted.- Returns:
- the converted Date value.
-
toDouble
This method converts an object to a double value with a default value of 0.- Parameters:
value
- Specifies the value to be converted.- Returns:
- the converted double value.
-
toFloat
This method converts an object to a float value.- Parameters:
value
- Specifies the value to be converted.- Returns:
- the converted float value.
-
toInteger
This method converts an object to a integer value with a default value of 0.- Parameters:
value
- Specifies the value to be converted.- Returns:
- the converted integer value.
-
toString
This method converts an object to a string value.- Parameters:
value
- Specifies the value to be converted.- Returns:
- the converted string value.
-
toTime
This method converts an object to a Time value.- Parameters:
value
- Specifies the value to be converted.- Returns:
- The converted Time value, or null if the conversion is not possible.
-
toBoolean
This method converts an object to a boolean value, with a default value if conversion is not possible.- Parameters:
value
- Specifies the value to be converted.defaultValue
- Specifies the default value to be returned if conversion is not possible.- Returns:
- the converted boolean value, or the default value if conversion is not possible.
-
toDouble
This method converts an object to a double value, with a default value if conversion is not possible.- Parameters:
value
- Specifies the value to be converted.defaultValue
- Specifies the default value to be returned if conversion is not possible.- Returns:
- the converted double value, or the default value if conversion is not possible.
-
toInteger
This method converts an object to a integer value, with a default value if conversion is not possible.- Parameters:
value
- Specifies the value to be converted.defaultValue
- Specifies the default value to be returned if conversion is not possible.- Returns:
- the converted integer value, or the default value if conversion is not possible.
-
toLong
This method converts an object to a long value with a default value of 0.- Parameters:
value
- Specifies the value to be converted.- Returns:
- the converted long value.
-
toLong
This method converts an object to a long value, with a default value if conversion is not possible.- Parameters:
value
- Specifies the value to be converted.defaultValue
- Specifies the default value to be returned if conversion is not possible.- Returns:
- the converted long value, or the default value if conversion is not possible.
-
toDate
This method converts an object to a date value, with a default value if conversion is not possible.- Parameters:
value
- Specifies the value to be converted.defaultValue
- Specifies the default value to be returned if conversion is not possible.- Returns:
- the converted date value, or the default value if conversion is not possible.
-