public class ConversionOps
extends java.lang.Object
Constructor and Description |
---|
ConversionOps() |
Modifier and Type | Method and Description |
---|---|
static int |
boolToInt(boolean value)
Converts the given boolean value into a binary integer.
|
static java.lang.String |
boolToString(boolean bool)
Returns a string representation of the given primitive boolean.
|
static boolean |
charInString(char c,
java.lang.String string)
Checks whether or not the given character is contained in the given string.
|
static java.lang.String |
colorToString(java.awt.Color color)
Returns a string representation of the given color.
|
static boolean |
extendsClass(java.lang.Class<?> extendingClass,
java.lang.Class<?> superClass)
Checks whether or not a class extends another class.
|
static java.lang.String |
extractNumber(java.lang.String string)
Extracts the first appearance of a number in the given string.
|
static boolean |
intToBool(int value)
Converts the given integer value into a boolean value.
|
static java.lang.Double |
toDouble(java.lang.Object value)
Calls toDouble(value,null)
|
static java.lang.Double |
toDouble(java.lang.Object value,
java.lang.Double defaultValue)
Tries to convert the given object into a double value.
|
static java.lang.Float |
toFloat(java.lang.Object value)
Calls toFloat(value,null)
|
static java.lang.Float |
toFloat(java.lang.Object value,
java.lang.Float defaultValue)
Tries to convert the given object value into a double value.
|
static java.lang.Integer |
toInteger(java.lang.Object value)
Calls toInteger(value,null)
|
static java.lang.Integer |
toInteger(java.lang.Object value,
java.lang.Integer defaultValue)
Tries to convert the given object value into an integer value.
|
public static java.lang.Double toDouble(java.lang.Object value, java.lang.Double defaultValue)
value
- the value to convert. Can be a Double, another Number, a String or a Boolean.defaultValue
- the value to return, if the given value could not be converted.public static java.lang.Double toDouble(java.lang.Object value)
public static java.lang.Float toFloat(java.lang.Object value, java.lang.Float defaultValue)
value
- the value to convert. Can be a Float, another Number, a String or a Boolean.defaultValue
- the value to return, if the given value could not be converted.public static java.lang.Float toFloat(java.lang.Object value)
public static java.lang.Integer toInteger(java.lang.Object value, java.lang.Integer defaultValue)
value
- the value to convert. Can be a Integer, another Number, a String or a Boolean.defaultValue
- the value to return, if the given value could not be converted.public static java.lang.Integer toInteger(java.lang.Object value)
public static int boolToInt(boolean value)
value
- the value to convert.public static boolean intToBool(int value)
value
- the value to convert.public static boolean extendsClass(java.lang.Class<?> extendingClass, java.lang.Class<?> superClass)
extendingClass
- the extending class to check.superClass
- the super class to check.public static java.lang.String colorToString(java.awt.Color color)
color
- the color to convert into a string.public static boolean charInString(char c, java.lang.String string)
c
- the character to check.string
- the string which may contain the character.public static java.lang.String extractNumber(java.lang.String string)
string
- the string containing a number.public static final java.lang.String boolToString(boolean bool)
bool
- the boolean to convert into a string.