Package rife.tools

Class Convert

java.lang.Object
rife.tools.Convert

public final class Convert extends Object
General purpose class providing methods to convert between data types.
Since:
1.0
  • Method Details

    • toType

      public static Object toType(Object value, Class<?> target) throws ConversionException
      Converts the given value into the specified target class.
      Parameters:
      value - the value to be converted.
      target - the class representing the target type of the conversion.
      Returns:
      the value converted to the target type
      Throws:
      ConversionException - if the value can't be converted to the target type.
      Since:
      1.0
    • fromString

      public static Object fromString(String string, Class<?> type) throws ConversionException
      Converts the given string into an object of specified type.
      Parameters:
      string - the string to be converted.
      type - the class representing the target type of the conversion.
      Returns:
      the string converted to the target type.
      Throws:
      ConversionException - if the string can't be converted to the target type.
      Since:
      1.5.20
    • toString

      public static String toString(Object value)
      Returns the string representation of the specified object.

      If null is provided as value, the result will also be null and not the string literal "null".

      Parameters:
      value - the object to convert to string.
      Returns:
      the string representation of the specified object.
      Since:
      1.0
    • toChar

      public static char toChar(Object value, char defaultValue)
      Converts the specified object to a char value; returns the default value if the conversion fails.
      Parameters:
      value - the object to convert to char.
      defaultValue - the default value.
      Returns:
      the char value represented by the specified object or the default value if the conversion fails.
      Since:
      1.0
    • toChar

      public static char toChar(Object value) throws ConversionException
      Converts the specified object to a char value.
      Parameters:
      value - the object to convert to char.
      Returns:
      the char value represented by the specified object.
      Throws:
      ConversionException - if the specified object cannot be converted to a char value.
      Since:
      1.0
    • toBoolean

      public static boolean toBoolean(Object value, boolean defaultValue)
      Converts the specified object to a boolean value; returns the default value if the conversion fails.
      Parameters:
      value - the object to convert to boolean.
      defaultValue - the default value.
      Returns:
      the boolean value represented by the specified object or the default value if the conversion fails.
      Since:
      1.0
    • toBoolean

      public static boolean toBoolean(Object value) throws ConversionException
      Converts the specified object to a boolean value.
      Parameters:
      value - the object to convert to boolean.
      Returns:
      the boolean value represented by the specified object.
      Throws:
      ConversionException - if the specified object cannot be converted to a boolean value.
      Since:
      1.0
    • toByte

      public static byte toByte(Object value, byte defaultValue)
      Converts the specified object to a byte value; returns the default value if the conversion fails.
      Parameters:
      value - the object to convert to byte.
      defaultValue - the default value.
      Returns:
      the byte value represented by the specified object or the default value if the conversion fails.
      Since:
      1.0
    • toByte

      public static byte toByte(Object value) throws ConversionException
      Converts the specified object to a byte value.
      Parameters:
      value - the object to convert to byte.
      Returns:
      the byte value represented by the specified object.
      Throws:
      ConversionException - if the specified object cannot be converted to a byte value.
      Since:
      1.0
    • toShort

      public static short toShort(Object value, short defaultValue)
      Converts the specified object to a short value; returns the default value if the conversion fails.
      Parameters:
      value - the object to convert to short.
      defaultValue - the default value.
      Returns:
      the short value represented by the specified object or the default value if the conversion fails.
      Since:
      1.0
    • toShort

      public static short toShort(Object value) throws ConversionException
      Converts the specified object to a short value.
      Parameters:
      value - the object to convert to short.
      Returns:
      the short value represented by the specified object.
      Throws:
      ConversionException - if the specified object cannot be converted to a short value.
      Since:
      1.0
    • toInt

      public static int toInt(Object value, int defaultValue)
      Converts the specified object to an int value; returns the default value if the conversion fails.
      Parameters:
      value - the object to convert to int.
      defaultValue - the default value.
      Returns:
      the int value represented by the specified object or the default value if the conversion fails.
      Since:
      1.0
    • toInt

      public static int toInt(Object value) throws ConversionException
      Converts the specified object to an int value.
      Parameters:
      value - the object to convert to int.
      Returns:
      the int value represented by the specified object.
      Throws:
      ConversionException - if the specified object cannot be converted to an int value.
      Since:
      1.0
    • toLong

      public static long toLong(Object value, long defaultValue)
      Converts the specified object to a long value; returns the default value if the conversion fails.
      Parameters:
      value - the object to convert to long.
      defaultValue - the default value.
      Returns:
      the long value represented by the specified object or the default value if the conversion fails.
      Since:
      1.0
    • toLong

      public static long toLong(Object value) throws ConversionException
      Converts the specified object to a long value.
      Parameters:
      value - the object to convert to long.
      Returns:
      the long value represented by the specified object.
      Throws:
      ConversionException - if the specified object cannot be converted to a long value.
      Since:
      1.0
    • toFloat

      public static float toFloat(Object value, float defaultValue)
      Converts the specified object to a float value; returns the default value if the conversion fails.
      Parameters:
      value - the object to convert to float.
      defaultValue - the default value.
      Returns:
      the float value represented by the specified object or the default value if the conversion fails.
      Since:
      1.0
    • toFloat

      public static float toFloat(Object value) throws ConversionException
      Converts the specified object to a float value.
      Parameters:
      value - the object to convert to float.
      Returns:
      the float value represented by the specified object.
      Throws:
      ConversionException - if the specified object cannot be converted to a float value.
      Since:
      1.0
    • toDouble

      public static double toDouble(Object value, double defaultValue)
      Converts the specified object to a double value; returns the default value if the conversion fails.
      Parameters:
      value - the object to convert to double.
      defaultValue - the default value.
      Returns:
      the double value represented by the specified object or the default value if the conversion fails.
      Since:
      1.0
    • toDouble

      public static double toDouble(Object value) throws ConversionException
      Converts the specified object to a double value.
      Parameters:
      value - the object to convert to double.
      Returns:
      the double value represented by the specified object.
      Throws:
      ConversionException - if the specified object cannot be converted to a double value.
      Since:
      1.0
    • toDate

      public static Date toDate(Calendar cal)
      Converts a given Calendar object to a Date.
      Parameters:
      cal - the Calendar object to be converted to a Date
      Returns:
      the Date representing the Calendar object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(Date date)
      Converts a given java.sql.Date object to a Date.
      Parameters:
      date - the java.sql.Date object to be converted to a Date
      Returns:
      the Date representing the java.sql.Date object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(Time time)
      Converts a given Time object to a Date.
      Parameters:
      time - the Time object to be converted to a Date
      Returns:
      the Date representing the Time object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(Timestamp ts)
      Converts a given Timestamp object to a Date.
      Parameters:
      ts - the Timestamp object to be converted to a Date
      Returns:
      the Date representing the Timestamp object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(Instant instant)
      Converts a given Instant object to a Date.
      Parameters:
      instant - the Instant object to be converted to a Date
      Returns:
      the Date representing the Instant object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(LocalDateTime localDateTime)
      Converts a given LocalDateTime object to a Date.
      Parameters:
      localDateTime - the LocalDateTime object to be converted to a Date
      Returns:
      the Date representing the LocalDateTime object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(LocalDate localDate)
      Converts a given LocalDate object to a Date.
      Parameters:
      localDate - the LocalDate object to be converted to a Date
      Returns:
      the Date representing the LocalDate object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(LocalTime localTime)
      Converts a given LocalTime object to a Date.
      Parameters:
      localTime - the LocalTime object to be converted to a Date
      Returns:
      the Date representing the LocalTime object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(Number number)
      Converts a given Number object to a Date.
      Parameters:
      number - the Number object to be converted to a Date
      Returns:
      the Date representing the Number object passed as parameter, or null if it is null
      Since:
      1.0
    • toDate

      public static Date toDate(String string) throws ConversionException
      Converts a given String object to a Date.
      Parameters:
      string - the String object to be converted to a Date
      Returns:
      the Date representing the String object passed as parameter, or null if it is null
      Throws:
      ConversionException - if the String object passed cannot be converted to a Date
      Since:
      1.0
    • toDate

      public static Date toDate(Object value) throws ConversionException
      Converts a given object to a Date. Depending on the type of the object passed, it uses the appropriate method to convert it to a Date.
      Parameters:
      value - the Object to be converted to a Date
      Returns:
      the Date representing the Object passed as parameter, or null if it is null
      Throws:
      ConversionException - if the Object passed cannot be converted to a Date
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(Date date)
      Converts a java.util.Date object to a java.sql.Date object.
      Parameters:
      date - the java.util.Date object to be converted
      Returns:
      a java.sql.Date object representing the same date as the input
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(Calendar cal)
      Converts a java.util.Calendar object to a java.sql.Date object.
      Parameters:
      cal - the java.util.Calendar object to be converted
      Returns:
      a java.sql.Date object representing the same date as the input
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(Instant instant)
      Converts an Instant object to a java.sql.Date object.
      Parameters:
      instant - the Instant object to be converted
      Returns:
      a java.sql.Date object representing the same date as the input
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(LocalDateTime localDateTime)
      Converts a LocalDateTime object to a java.sql.Date object.
      Parameters:
      localDateTime - the LocalDateTime object to be converted
      Returns:
      a java.sql.Date object representing the same date as the input
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(LocalDate localDate)
      Converts a LocalDate object to a java.sql.Date object.
      Parameters:
      localDate - the LocalDate object to be converted
      Returns:
      a java.sql.Date object representing the same date as the input with time set to midnight
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(LocalTime localTime)
      Converts a LocalTime object to a java.sql.Date object.
      Parameters:
      localTime - the LocalTime object to be converted
      Returns:
      a java.sql.Date object representing the same time as the input with date set to epoch (1970-01-01)
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(Number number)
      Converts a Number object to a java.sql.Date object.
      Parameters:
      number - the Number object to be converted
      Returns:
      a java.sql.Date object representing the same date as the input
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(String string) throws ConversionException
      Converts a String object to a java.sql.Date object.
      Parameters:
      string - the String object to be converted
      Returns:
      a java.sql.Date object representing the same date as the input, parsed using a default format or specified format (if possible)
      Throws:
      ConversionException - if the input cannot be parsed to a java.sql.Date object using any of the available formats
      Since:
      1.0
    • toSqlDate

      public static Date toSqlDate(Object value) throws ConversionException
      Converts an object to a java.sql.Date object.
      Parameters:
      value - the object to be converted
      Returns:
      a java.sql.Date object representing the same date as the input, if the input is one of the supported types
      Throws:
      ConversionException - if the input is not one of the supported types
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(Date date)
      Converts a java.sql.Date object to a Timestamp object.
      Parameters:
      date - the java.sql.Date object to be converted
      Returns:
      a Timestamp object representing the same date and time as the input
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(Time time)
      Converts a java.sql.Time object to a Timestamp object.
      Parameters:
      time - the java.sql.Time object to be converted
      Returns:
      a Timestamp object representing the same time as the input
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(Date date)
      Converts a java.util.Date object to a Timestamp object.
      Parameters:
      date - the java.util.Date object to be converted
      Returns:
      a Timestamp object representing the same date and time as the input
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(Calendar cal)
      Converts a java.util.Calendar object to a Timestamp object.
      Parameters:
      cal - the java.util.Calendar object to be converted
      Returns:
      a Timestamp object representing the same date and time as the input
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(Instant instant)
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(LocalDateTime localDateTime)
      Converts a LocalDateTime object to a Timestamp object.
      Parameters:
      localDateTime - the LocalDateTime object to be converted
      Returns:
      a Timestamp object representing the same date and time as the input
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(LocalDate localDate)
      Converts a LocalDate object to a Timestamp object.
      Parameters:
      localDate - the LocalDate object to be converted
      Returns:
      a Timestamp object representing the same date and time as the input
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(LocalTime localTime)
      Converts a LocalTime object to a Timestamp object.
      Parameters:
      localTime - the LocalTime object to be converted
      Returns:
      a Timestamp object representing the same time as the input
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(Number number)
      Converts a Number object to a Timestamp object.
      Parameters:
      number - the Number object to be converted
      Returns:
      a Timestamp object representing the same time in milliseconds since Epoch as the input
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(String string) throws ConversionException
      Converts a String object to a Timestamp object.
      Parameters:
      string - the String object to be converted to a Timestamp
      Returns:
      a Timestamp object representing the same time as the input
      Throws:
      ConversionException - if the given string cannot be parsed as a timestamp
      Since:
      1.0
    • toSqlTimestamp

      public static Timestamp toSqlTimestamp(Object value) throws ConversionException
      Converts an object to a Timestamp object.
      Parameters:
      value - the object to be converted to a Timestamp
      Returns:
      object representing the same timestamp as the input, if the input is one of the supported types
      Throws:
      ConversionException - if the input is not one of the supported types
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(Timestamp ts)
      Converts a Timestamp object to a Time object.
      Parameters:
      ts - the Timestamp object to be converted
      Returns:
      a Time object representing the same time as the input Timestamp object
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(Date date)
      Converts a java.sql.Date object to a Time object.
      Parameters:
      date - the java.sql.Date object to be converted
      Returns:
      a Time object representing the same time as the input java.sql.Date object
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(Date date)
      Converts a Date object to a Time object.
      Parameters:
      date - the Date object to be converted
      Returns:
      a Time object representing the same time as the input Date object
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(Calendar cal)
      Converts a Calendar object to a Time object.
      Parameters:
      cal - the Calendar object to be converted
      Returns:
      a Time object representing the same time as the input Calendar object
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(Instant instant)
      Converts an Instant object to a Time object.
      Parameters:
      instant - the Instant object to be converted
      Returns:
      a Time object representing the same time as the input Instant object
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(LocalDateTime localDateTime)
      Converts a LocalDateTime object to a Time object.
      Parameters:
      localDateTime - the LocalDateTime object to be converted
      Returns:
      a Time object representing the same time as the input LocalDateTime object
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(LocalDate localDate)
      Converts a LocalDate object to a Time object.
      Parameters:
      localDate - the LocalDate object to be converted
      Returns:
      a Time object representing midnight for the input LocalDate object
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(LocalTime localTime)
      Converts a LocalTime object to a Time object.
      Parameters:
      localTime - the LocalTime object to be converted
      Returns:
      a Time object representing the same time as the input LocalTime object on January 1, 1970
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(Number number)
      Converts a Number object to a Time object.
      Parameters:
      number - the Number object to be converted
      Returns:
      a Time object representing the same time as the input Number object, treated as a number of milliseconds since January 1, 1970
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(String string) throws ConversionException
      Converts a String object to a Time object.
      Parameters:
      string - the String object to be converted
      Returns:
      a Time object representing the same time as the input String object
      Throws:
      ConversionException - if the input String cannot be parsed as a Time object
      Since:
      1.0
    • toSqlTime

      public static Time toSqlTime(Object value) throws ConversionException
      Converts an object to a TIme object.
      Parameters:
      value - the object to be converted to a Time
      Returns:
      object representing the same time as the input, if the input is one of the supported types
      Throws:
      ConversionException - if the input is not one of the supported types
      Since:
      1.0
    • toInstant

      public static Instant toInstant(Date date)
      Converts a java.sql.Date to an Instant.
      Parameters:
      date - the date to be converted.
      Returns:
      the instant representing the provided date or null if the date is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(Time time)
      Converts a Time to an Instant.
      Parameters:
      time - the time to be converted.
      Returns:
      the instant representing the provided time or null if the time is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(Timestamp ts)
      Converts a Timestamp to an Instant.
      Parameters:
      ts - the timestamp to be converted.
      Returns:
      the instant representing the provided timestamp or null if the timestamp is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(Date date)
      Converts a Date to an Instant.
      Parameters:
      date - the date to be converted.
      Returns:
      the instant representing the provided date or null if the date is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(Calendar cal)
      Converts a Calendar to an Instant.
      Parameters:
      cal - the calendar to be converted.
      Returns:
      the instant representing the provided calendar or null if the calendar is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(LocalDateTime localDateTime)
      Converts a LocalDateTime to an Instant.
      Parameters:
      localDateTime - the LocalDateTime to be converted.
      Returns:
      the instant representing the provided LocalDateTime or null if the LocalDateTime is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(LocalDate localDate)
      Converts a LocalDate to an Instant.
      Parameters:
      localDate - the LocalDate to be converted.
      Returns:
      the instant representing the provided LocalDate or null if the LocalDate is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(LocalTime localTime)
      Converts a LocalTime to an Instant.
      Parameters:
      localTime - the LocalTime to be converted.
      Returns:
      the instant representing the provided LocalTime or null if the LocalTime is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(Number number)
      Converts a Number to an Instant.
      Parameters:
      number - the Number to be converted.
      Returns:
      the instant representing the provided Number or null if the Number is null.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(String string) throws ConversionException
      Converts a String to an Instant.
      Parameters:
      string - the String to be converted.
      Returns:
      the instant representing the provided String or null if the String is null.
      Throws:
      ConversionException - if the String cannot be converted to an Instant.
      Since:
      1.0
    • toInstant

      public static Instant toInstant(Object value) throws ConversionException
      Converts an Object to an Instant.
      Parameters:
      value - the Object to be converted.
      Returns:
      the instant representing the provided Object or null if the Object is null.
      Throws:
      ConversionException - if the Object cannot be converted to an Instant.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Timestamp ts)
      Converts a java.sql.Timestamp to a LocalDateTime object.
      Parameters:
      ts - the java.sql.Timestamp to convert
      Returns:
      the LocalDateTime object equivalent to the given timestamp, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Date date)
      Converts a java.sql.Date to a LocalDateTime object.
      Parameters:
      date - the java.sql.Date to convert
      Returns:
      the LocalDateTime object equivalent to the given date, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Time time)
      Converts a java.sql.Time to a LocalDateTime object.
      Parameters:
      time - the java.sql.Time to convert
      Returns:
      the LocalDateTime object equivalent to the given time, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Date date)
      Converts a java.util.Date to a LocalDateTime object.
      Parameters:
      date - the java.util.Date to convert
      Returns:
      the LocalDateTime object equivalent to the given date, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Calendar cal)
      Converts a java.util.Calendar to a LocalDateTime object.
      Parameters:
      cal - the java.util.Calendar to convert
      Returns:
      the LocalDateTime object equivalent to the given calendar, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Instant instant)
      Converts an Instant to a LocalDateTime object.
      Parameters:
      instant - the Instant to convert
      Returns:
      the LocalDateTime object equivalent to the given instant, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(LocalDate localDate)
      Converts a LocalDate to a LocalDateTime object.
      Parameters:
      localDate - the LocalDate to convert
      Returns:
      the LocalDateTime object representing the start of the given date, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(LocalTime localTime)
      Converts a LocalTime to a LocalDateTime object.
      Parameters:
      localTime - the LocalTime to convert
      Returns:
      the LocalDateTime object representing the given time on Jan 1, 1970, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Number number)
      Converts a Number to a LocalDateTime object.
      Parameters:
      number - the Number object to convert
      Returns:
      the LocalDateTime object equivalent to the millisecond epoch value of the given number, or null if the input is null.
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(String string) throws ConversionException
      Converts a String to a LocalDateTime object.
      Parameters:
      string - the String to convert
      Returns:
      the LocalDateTime object parsed from the given string, or null if the input is null.
      Throws:
      ConversionException - if the string cannot be parsed as a LocalDateTime object
      Since:
      1.0
    • toLocalDateTime

      public static LocalDateTime toLocalDateTime(Object value) throws ConversionException
      Converts an Object to an LocalDateTime.
      Parameters:
      value - the Object to convert
      Returns:
      the LocalDateTime object corresponding to the given object, or null if the input is null.
      Throws:
      ConversionException - if the object cannot be converted to a LocalDateTime object
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(Timestamp ts)
      Converts a Timestamp to a LocalDate.
      Parameters:
      ts - The Timestamp to convert
      Returns:
      The corresponding LocalDate, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(Date date)
      Converts a java.sql.Date to a LocalDate.
      Parameters:
      date - The sql Date to convert
      Returns:
      The corresponding LocalDate, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(Time time)
      Converts a Time to a LocalDate. Always returns LocalDate.EPOCH.
      Parameters:
      time - The Time to convert
      Returns:
      LocalDate.EPOCH, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(Date date)
      Converts a Date to a LocalDate using the default zone ID defined in RifeConfig.
      Parameters:
      date - The Date to convert
      Returns:
      The corresponding LocalDate, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(Calendar cal)
      Converts a Calendar to a LocalDate using the default zone ID defined in RifeConfig.
      Parameters:
      cal - The Calendar to convert
      Returns:
      The corresponding LocalDate, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(Instant instant)
      Converts an Instant to a LocalDate using the default zone ID defined in RifeConfig.
      Parameters:
      instant - The Instant to convert
      Returns:
      The corresponding LocalDate, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(LocalDateTime localDateTime)
      Converts a LocalDateTime to a LocalDate.
      Parameters:
      localDateTime - The LocalDateTime to convert
      Returns:
      The corresponding LocalDate, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(LocalTime localTime)
      Converts a LocalTime to a LocalDate. Always returns LocalDate.EPOCH.
      Parameters:
      localTime - The LocalTime to convert
      Returns:
      LocalDate.EPOCH, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(Number number)
      Converts a Number representing an epoch millisecond timestamp to a LocalDate using the default zone ID defined in RifeConfig.
      Parameters:
      number - The Number to convert
      Returns:
      The corresponding LocalDate, or null if the input is null
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(String string) throws ConversionException
      Converts a String representation of a date/time to a LocalDate using various parsing strategies.
      Parameters:
      string - The String to convert
      Returns:
      The corresponding LocalDate
      Throws:
      ConversionException - If the input string cannot be parsed as a LocalDate
      Since:
      1.0
    • toLocalDate

      public static LocalDate toLocalDate(Object value) throws ConversionException
      Converts an Object to a LocalDate.
      Parameters:
      value - The Object to convert
      Returns:
      The corresponding LocalDate
      Throws:
      ConversionException - If the input Object cannot be converted to a LocalDate
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(Date date)
      Converts a java.sql.Date object to a LocalTime object.
      Parameters:
      date - the java.sql.Date object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(Timestamp ts)
      Converts a Timestamp object to a LocalTime object.
      Parameters:
      ts - the Timestamp object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(Time time)
      Converts a Time object to a LocalTime object.
      Parameters:
      time - the Time object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(Date date)
      Converts a Date object to a LocalTime object.
      Parameters:
      date - the Date object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(Calendar cal)
      Converts a Calendar object to a LocalTime object.
      Parameters:
      cal - the Calendar object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(Instant instant)
      Converts an Instant object to a LocalTime object.
      Parameters:
      instant - the Instant object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(LocalDateTime localDateTime)
      Converts a LocalDateTime object to a LocalTime object.
      Parameters:
      localDateTime - the LocalDateTime object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(LocalDate localDate)
      Converts a LocalDate object to a LocalTime object.
      Parameters:
      localDate - the LocalDate object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(Number number)
      Converts a Number object to a LocalTime object.
      Parameters:
      number - the Number object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(String string) throws ConversionException
      Converts a String object to a LocalTime object.
      Parameters:
      string - the String object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Throws:
      ConversionException - if the conversion process fails
      Since:
      1.0
    • toLocalTime

      public static LocalTime toLocalTime(Object value) throws ConversionException
      Converts an Object to a LocalTime object.
      Parameters:
      value - the Object to convert
      Returns:
      the resulting LocalTime object or null if the input is null
      Throws:
      ConversionException - if the conversion process fails
      Since:
      1.0
    • getDefaultValue

      public static <T> T getDefaultValue(Class<T> clazz)
      Returns the default value of a given class.
      Parameters:
      clazz - the class whose default value is to be returned
      Returns:
      the default value of the given class
      Since:
      1.0