Class ComparableUtil
Defines helper class for works with Comparable.
Inherited Members
Namespace:
Assembly: .dll
Syntax
public class ComparableUtil
Constructors
ComparableUtil()
Declaration
public ComparableUtil()
Methods
<T>compare(T a, T b)
Compares two Comparable values.
Declaration
public static int <T>compare(T a, T b)
Parameters
| Type | Name | Description |
|---|---|---|
| T | a | The first argument. |
| T | b | The second argument. |
Returns
| Type | Description |
|---|---|
| int | The result of comparison. |
<T>fromDouble(double rawDataValue, Class<T> type)
Converts double value to specified Comparable type.
Declaration
public static T <T>fromDouble(double rawDataValue, Class<T> type)
Parameters
| Type | Name | Description |
|---|---|---|
| double | rawDataValue | The double value to convert. |
| Class<T> | type | The type of target to convert to. |
Returns
| Type | Description |
|---|---|
| T | The converted value. |
<T>max(T value1, T value2)
Gets bigger of two Comparable values.
Declaration
public static T <T>max(T value1, T value2)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value1 | The first argument. |
| T | value2 | The second argument. |
Returns
| Type | Description |
|---|---|
| T | The max value. |
<T>min(T value1, T value2)
Gets smaller of two Comparable values.
Declaration
public static T <T>min(T value1, T value2)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value1 | The first argument. |
| T | value2 | The second argument. |
Returns
| Type | Description |
|---|---|
| T | The min value. |
canConvertToBigDecimal(double value)
Checks if specified double value can be converted to BigDecimal.
Declaration
public static boolean canConvertToBigDecimal(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if value value can be converted to BigDecimal. |
canConvertToByte(double value)
Checks if specified double value can be converted to byte.
Declaration
public static boolean canConvertToByte(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if value value can be converted to byte. |
canConvertToDate(double value)
Checks if specified double value can be converted to Date.
Declaration
public static boolean canConvertToDate(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if value value can be converted to Date. |
canConvertToFloat(double value)
Checks if specified double value can be converted to float.
Declaration
public static boolean canConvertToFloat(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if value value can be converted to float. |
canConvertToInteger(double value)
Checks if specified double value can be converted to int.
Declaration
public static boolean canConvertToInteger(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if value value can be converted to int. |
canConvertToLong(double value)
Checks if specified double value can be converted to long.
Declaration
public static boolean canConvertToLong(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if value value can be converted to long. |
canConvertToShort(double value)
Checks if specified double value can be converted to short.
Declaration
public static boolean canConvertToShort(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if value value can be converted to short. |
isDefined(byte arg)
Checks if specified argument is defined.
Declaration
public static boolean isDefined(byte arg)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | arg | The argument to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if argument value is defined. |
isDefined(double arg)
Checks if specified argument is defined.
Declaration
public static boolean isDefined(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| double | arg | The argument to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if argument value is defined. |
isDefined(float arg)
Checks if specified argument is defined.
Declaration
public static boolean isDefined(float arg)
Parameters
| Type | Name | Description |
|---|---|---|
| float | arg | The argument to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if argument value is defined. |
isDefined(int arg)
Checks if specified argument is defined.
Declaration
public static boolean isDefined(int arg)
Parameters
| Type | Name | Description |
|---|---|---|
| int | arg | The argument to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if argument value is defined. |
isDefined(Comparable comparable)
Checks if specified argument is defined.
Declaration
public static boolean isDefined(Comparable comparable)
Parameters
| Type | Name | Description |
|---|---|---|
| Comparable | comparable | The argument to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if argument value is defined. |
isDefined(Date arg)
Checks if specified argument is defined.
Declaration
public static boolean isDefined(Date arg)
Parameters
| Type | Name | Description |
|---|---|---|
| Date | arg | The argument to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if argument value is defined. |
isDefined(long arg)
Checks if specified argument is defined.
Declaration
public static boolean isDefined(long arg)
Parameters
| Type | Name | Description |
|---|---|---|
| long | arg | The argument to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if argument value is defined. |
isDefined(short arg)
Checks if specified argument is defined.
Declaration
public static boolean isDefined(short arg)
Parameters
| Type | Name | Description |
|---|---|---|
| short | arg | The argument to check. |
Returns
| Type | Description |
|---|---|
| boolean | True if argument value is defined. |
toDate(double value)
Converts double to its Date representation
Declaration
public static Date toDate(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The double value to convert |
Returns
| Type | Description |
|---|---|
| Date | The Date representation of the double value |
toDate(Comparable comparable)
Converts comparable to its Date representation.
Declaration
public static Date toDate(Comparable comparable)
Parameters
| Type | Name | Description |
|---|---|---|
| Comparable | comparable | The comparable to convert. |
Returns
| Type | Description |
|---|---|
| Date | The Date representation of the value. |
toDouble(double value)
Converts value to its double representation.
Declaration
public static double toDouble(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The value to convert. |
Returns
| Type | Description |
|---|---|
| double | The double representation of the value. |
toDouble(Comparable comparable)
Converts comparable to its double representation.
Declaration
public static double toDouble(Comparable comparable)
Parameters
| Type | Name | Description |
|---|---|---|
| Comparable | comparable | The comparable to convert. |
Returns
| Type | Description |
|---|---|
| double | The double representation of the value. |