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 booleanThis method converts an object to a boolean value withfalseas default value.static booleanThis method converts an object to a boolean value, with a default value if conversion is not possible.static DateThis method converts an object to a Date value with a default value ofnull.static DateThis method converts an object to a date value, with a default value if conversion is not possible.static doubleThis method converts an object to a double value with a default value of 0.static doubleThis method converts an object to a double value, with a default value if conversion is not possible.static floatThis method converts an object to a float value.static IntegerThis method converts an object to a integer value with a default value of 0.static intThis method converts an object to a integer value, with a default value if conversion is not possible.static longThis method converts an object to a long value with a default value of 0.static longThis method converts an object to a long value, with a default value if conversion is not possible.static StringThis method converts an object to a string value.static TimeThis 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 withfalseas 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.
-