Package rife.tools
Class Convert
java.lang.Object
rife.tools.Convert
General purpose class providing methods to convert between data types.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectfromString(String string, Class<?> type) Converts the given string into an object of specified type.static <T> TgetDefaultValue(Class<T> clazz) Returns the default value of a given class.static booleanConverts the specified object to a boolean value.static booleanConverts the specified object to a boolean value; returns the default value if the conversion fails.static byteConverts the specified object to a byte value.static byteConverts the specified object to a byte value; returns the default value if the conversion fails.static charConverts the specified object to a char value.static charConverts the specified object to a char value; returns the default value if the conversion fails.static DateConverts a given Number object to a Date.static DateConverts a given object to a Date.static DateConverts a given String object to a Date.static DateConverts a given java.sql.Date object to a Date.static DateConverts a given Time object to a Date.static DateConverts a given Timestamp object to a Date.static DateConverts a given Instant object to a Date.static DateConverts a given LocalDate object to a Date.static DatetoDate(LocalDateTime localDateTime) Converts a given LocalDateTime object to a Date.static DateConverts a given LocalTime object to a Date.static DateConverts a given Calendar object to a Date.static doubleConverts the specified object to a double value.static doubleConverts the specified object to a double value; returns the default value if the conversion fails.static floatConverts the specified object to a float value.static floatConverts the specified object to a float value; returns the default value if the conversion fails.static InstantConverts a Number to an Instant.static InstantConverts an Object to an Instant.static InstantConverts a String to an Instant.static InstantConverts a java.sql.Date to an Instant.static InstantConverts a Time to an Instant.static InstantConverts a Timestamp to an Instant.static InstantConverts a LocalDate to an Instant.static InstanttoInstant(LocalDateTime localDateTime) Converts a LocalDateTime to an Instant.static InstantConverts a LocalTime to an Instant.static InstantConverts a Calendar to an Instant.static InstantConverts a Date to an Instant.static intConverts the specified object to an int value.static intConverts the specified object to an int value; returns the default value if the conversion fails.static LocalDatetoLocalDate(Number number) Converts a Number representing an epoch millisecond timestamp to a LocalDate using the default zone ID defined in RifeConfig.static LocalDatetoLocalDate(Object value) Converts an Object to a LocalDate.static LocalDatetoLocalDate(String string) Converts a String representation of a date/time to a LocalDate using various parsing strategies.static LocalDatetoLocalDate(Date date) Converts a java.sql.Date to a LocalDate.static LocalDatetoLocalDate(Time time) Converts a Time to a LocalDate.static LocalDatetoLocalDate(Timestamp ts) Converts a Timestamp to a LocalDate.static LocalDatetoLocalDate(Instant instant) Converts an Instant to a LocalDate using the default zone ID defined in RifeConfig.static LocalDatetoLocalDate(LocalDateTime localDateTime) Converts a LocalDateTime to a LocalDate.static LocalDatetoLocalDate(LocalTime localTime) Converts a LocalTime to a LocalDate.static LocalDatetoLocalDate(Calendar cal) Converts a Calendar to a LocalDate using the default zone ID defined in RifeConfig.static LocalDatetoLocalDate(Date date) Converts a Date to a LocalDate using the default zone ID defined in RifeConfig.static LocalDateTimetoLocalDateTime(Number number) Converts a Number to a LocalDateTime object.static LocalDateTimetoLocalDateTime(Object value) Converts an Object to an LocalDateTime.static LocalDateTimetoLocalDateTime(String string) Converts a String to a LocalDateTime object.static LocalDateTimetoLocalDateTime(Date date) Converts a java.sql.Date to a LocalDateTime object.static LocalDateTimetoLocalDateTime(Time time) Converts a java.sql.Time to a LocalDateTime object.static LocalDateTimeConverts a java.sql.Timestamp to a LocalDateTime object.static LocalDateTimetoLocalDateTime(Instant instant) Converts an Instant to a LocalDateTime object.static LocalDateTimetoLocalDateTime(LocalDate localDate) Converts a LocalDate to a LocalDateTime object.static LocalDateTimetoLocalDateTime(LocalTime localTime) Converts a LocalTime to a LocalDateTime object.static LocalDateTimetoLocalDateTime(Calendar cal) Converts a java.util.Calendar to a LocalDateTime object.static LocalDateTimetoLocalDateTime(Date date) Converts a java.util.Date to a LocalDateTime object.static LocalTimetoLocalTime(Number number) Converts a Number object to a LocalTime object.static LocalTimetoLocalTime(Object value) Converts an Object to a LocalTime object.static LocalTimetoLocalTime(String string) Converts a String object to a LocalTime object.static LocalTimetoLocalTime(Date date) Converts a java.sql.Date object to a LocalTime object.static LocalTimetoLocalTime(Time time) Converts a Time object to a LocalTime object.static LocalTimetoLocalTime(Timestamp ts) Converts a Timestamp object to a LocalTime object.static LocalTimetoLocalTime(Instant instant) Converts an Instant object to a LocalTime object.static LocalTimetoLocalTime(LocalDate localDate) Converts a LocalDate object to a LocalTime object.static LocalTimetoLocalTime(LocalDateTime localDateTime) Converts a LocalDateTime object to a LocalTime object.static LocalTimetoLocalTime(Calendar cal) Converts a Calendar object to a LocalTime object.static LocalTimetoLocalTime(Date date) Converts a Date object to a LocalTime object.static longConverts the specified object to a long value.static longConverts the specified object to a long value; returns the default value if the conversion fails.static shortConverts the specified object to a short value.static shortConverts the specified object to a short value; returns the default value if the conversion fails.static DateConverts a Number object to a java.sql.Date object.static DateConverts an object to a java.sql.Date object.static DateConverts a String object to a java.sql.Date object.static DateConverts an Instant object to a java.sql.Date object.static DateConverts a LocalDate object to a java.sql.Date object.static DatetoSqlDate(LocalDateTime localDateTime) Converts a LocalDateTime object to a java.sql.Date object.static DateConverts a LocalTime object to a java.sql.Date object.static DateConverts a java.util.Calendar object to a java.sql.Date object.static DateConverts a java.util.Date object to a java.sql.Date object.static TimeConverts a Number object to a Time object.static TimeConverts an object to a TIme object.static TimeConverts a String object to a Time object.static TimeConverts a java.sql.Date object to a Time object.static TimeConverts a Timestamp object to a Time object.static TimeConverts an Instant object to a Time object.static TimeConverts a LocalDate object to a Time object.static TimetoSqlTime(LocalDateTime localDateTime) Converts a LocalDateTime object to a Time object.static TimeConverts a LocalTime object to a Time object.static TimeConverts a Calendar object to a Time object.static TimeConverts a Date object to a Time object.static TimestamptoSqlTimestamp(Number number) Converts a Number object to a Timestamp object.static TimestamptoSqlTimestamp(Object value) Converts an object to a Timestamp object.static TimestamptoSqlTimestamp(String string) Converts a String object to a Timestamp object.static TimestamptoSqlTimestamp(Date date) Converts a java.sql.Date object to a Timestamp object.static TimestamptoSqlTimestamp(Time time) Converts a java.sql.Time object to a Timestamp object.static TimestamptoSqlTimestamp(Instant instant) static TimestamptoSqlTimestamp(LocalDate localDate) Converts a LocalDate object to a Timestamp object.static TimestamptoSqlTimestamp(LocalDateTime localDateTime) Converts a LocalDateTime object to a Timestamp object.static TimestamptoSqlTimestamp(LocalTime localTime) Converts a LocalTime object to a Timestamp object.static TimestamptoSqlTimestamp(Calendar cal) Converts a java.util.Calendar object to a Timestamp object.static TimestamptoSqlTimestamp(Date date) Converts a java.util.Date object to a Timestamp object.static StringReturns the string representation of the specified object.static ObjectConverts the given value into the specified target class.
-
Method Details
-
toType
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
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
Returns the string representation of the specified object.If
nullis provided as value, the result will also benulland 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
-
toSqlTimestamp
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
-