public final class Converter extends Object
Modifier and Type | Method and Description |
---|---|
Convert<?> |
addConversion(Class<?> source,
Class<?> target,
Convert<?> conversionFunction)
Add a new conversion.
|
static Map<Class<?>,Set<Class<?>>> |
allSupportedConversions() |
static <T> T |
convert(Object fromInstance,
Class<T> toType)
Uses the default configuration options for your system.
|
static AtomicBoolean |
convert2AtomicBoolean(Object fromInstance)
Convert from the passed in instance to an AtomicBoolean.
|
static AtomicInteger |
convert2AtomicInteger(Object fromInstance)
Convert from the passed in instance to an AtomicInteger.
|
static AtomicLong |
convert2AtomicLong(Object fromInstance)
Convert from the passed in instance to an AtomicLong.
|
static BigDecimal |
convert2BigDecimal(Object fromInstance)
Convert from the passed in instance to a BigDecimal.
|
static BigInteger |
convert2BigInteger(Object fromInstance)
Convert from the passed in instance to a BigInteger.
|
static boolean |
convert2boolean(Object fromInstance)
Convert from the passed in instance to a boolean.
|
static byte |
convert2byte(Object fromInstance)
Convert from the passed in instance to a byte.
|
static char |
convert2char(Object fromInstance)
Convert from the passed in instance to a char.
|
static double |
convert2double(Object fromInstance)
Convert from the passed in instance to a double.
|
static float |
convert2float(Object fromInstance)
Convert from the passed in instance to a float.
|
static int |
convert2int(Object fromInstance)
Convert from the passed in instance to an int.
|
static long |
convert2long(Object fromInstance)
Convert from the passed in instance to an long.
|
static short |
convert2short(Object fromInstance)
Convert from the passed in instance to a short.
|
static String |
convert2String(Object fromInstance)
Convert from the passed in instance to a String.
|
static AtomicBoolean |
convertToAtomicBoolean(Object fromInstance)
Convert from the passed in instance to an AtomicBoolean.
|
static AtomicInteger |
convertToAtomicInteger(Object fromInstance)
Convert from the passed in instance to an AtomicInteger.
|
static AtomicLong |
convertToAtomicLong(Object fromInstance)
Convert from the passed in instance to an AtomicLong.
|
static BigDecimal |
convertToBigDecimal(Object fromInstance)
Convert from the passed in instance to a BigDecimal.
|
static BigInteger |
convertToBigInteger(Object fromInstance)
Convert from the passed in instance to a BigInteger.
|
static Boolean |
convertToBoolean(Object fromInstance)
Convert from the passed in instance to a Boolean.
|
static Byte |
convertToByte(Object fromInstance)
Convert from the passed in instance to a Byte.
|
static Calendar |
convertToCalendar(Object fromInstance)
Convert from the passed in instance to a Calendar.
|
static Character |
convertToCharacter(Object fromInstance)
Convert from the passed in instance to a Character.
|
static Date |
convertToDate(Object fromInstance)
Convert from the passed in instance to a Date.
|
static Double |
convertToDouble(Object fromInstance)
Convert from the passed in instance to a Double.
|
static Float |
convertToFloat(Object fromInstance)
Convert from the passed in instance to a Float.
|
static Integer |
convertToInteger(Object fromInstance)
Convert from the passed in instance to an Integer.
|
static LocalDate |
convertToLocalDate(Object fromInstance)
Convert from the passed in instance to a LocalDate.
|
static LocalDateTime |
convertToLocalDateTime(Object fromInstance)
Convert from the passed in instance to a LocalDateTime.
|
static Long |
convertToLong(Object fromInstance)
Convert from the passed in instance to a Long.
|
static Short |
convertToShort(Object fromInstance)
Convert from the passed in instance to a Short.
|
static Date |
convertToSqlDate(Object fromInstance)
Convert from the passed in instance to a java.sql.Date.
|
static String |
convertToString(Object fromInstance)
Convert from the passed in instance to a String.
|
static Timestamp |
convertToTimestamp(Object fromInstance)
Convert from the passed in instance to a Timestamp.
|
static ZonedDateTime |
convertToZonedDateTime(Object fromInstance)
Convert from the passed in instance to a Date.
|
static Map<String,Set<String>> |
getSupportedConversions() |
static boolean |
isConversionSupportedFor(Class<?> source,
Class<?> target)
Check to see if a conversion from type to another type is supported (may use inheritance via super classes/interfaces).
|
static long |
localDateTimeToMillis(LocalDateTime localDateTime)
Deprecated.
|
static long |
localDateToMillis(LocalDate localDate)
Deprecated.
|
static long |
zonedDateTimeToMillis(ZonedDateTime zonedDateTime)
Deprecated.
|
public static Converter instance
public static <T> T convert(Object fromInstance, Class<T> toType)
public static boolean isConversionSupportedFor(Class<?> source, Class<?> target)
source
- Class of source type.target
- Class of target type.public static Map<Class<?>,Set<Class<?>>> allSupportedConversions()
public static Map<String,Set<String>> getSupportedConversions()
public Convert<?> addConversion(Class<?> source, Class<?> target, Convert<?> conversionFunction)
source
- Class to convert from.target
- Class to convert to.conversionFunction
- Convert function that converts from the source type to the destination type.public static String convert2String(Object fromInstance)
public static String convertToString(Object fromInstance)
public static BigDecimal convert2BigDecimal(Object fromInstance)
public static BigDecimal convertToBigDecimal(Object fromInstance)
public static BigInteger convert2BigInteger(Object fromInstance)
public static BigInteger convertToBigInteger(Object fromInstance)
public static Date convertToSqlDate(Object fromInstance)
public static Timestamp convertToTimestamp(Object fromInstance)
public static Date convertToDate(Object fromInstance)
public static LocalDate convertToLocalDate(Object fromInstance)
public static LocalDateTime convertToLocalDateTime(Object fromInstance)
public static ZonedDateTime convertToZonedDateTime(Object fromInstance)
public static Calendar convertToCalendar(Object fromInstance)
public static char convert2char(Object fromInstance)
public static Character convertToCharacter(Object fromInstance)
public static byte convert2byte(Object fromInstance)
public static Byte convertToByte(Object fromInstance)
public static short convert2short(Object fromInstance)
public static Short convertToShort(Object fromInstance)
public static int convert2int(Object fromInstance)
public static Integer convertToInteger(Object fromInstance)
public static long convert2long(Object fromInstance)
public static Long convertToLong(Object fromInstance)
public static float convert2float(Object fromInstance)
public static Float convertToFloat(Object fromInstance)
public static double convert2double(Object fromInstance)
public static Double convertToDouble(Object fromInstance)
public static boolean convert2boolean(Object fromInstance)
public static Boolean convertToBoolean(Object fromInstance)
public static AtomicInteger convert2AtomicInteger(Object fromInstance)
public static AtomicInteger convertToAtomicInteger(Object fromInstance)
public static AtomicLong convert2AtomicLong(Object fromInstance)
public static AtomicLong convertToAtomicLong(Object fromInstance)
public static AtomicBoolean convert2AtomicBoolean(Object fromInstance)
public static AtomicBoolean convertToAtomicBoolean(Object fromInstance)
@Deprecated public static long localDateToMillis(LocalDate localDate)
localDate
- A Java LocalDate@Deprecated public static long localDateTimeToMillis(LocalDateTime localDateTime)
localDateTime
- A Java LocalDateTime@Deprecated public static long zonedDateTimeToMillis(ZonedDateTime zonedDateTime)
zonedDateTime
- A Java ZonedDateTimeCopyright © 2024. All rights reserved.