Class ValueUtils
java.lang.Object
com.kingsrook.qqq.backend.core.utils.ValueUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetFirstNonNull(T... ts) Return the first argument that isn't null.static ZoneIdGet the (time) zoneId either for the current user session (based on session value UserTimezone or UserTimezoneOffsetMinutes), else the instance's defaultTimeZoneId string.static InstantgetStartOfDayInZoneId(Instant when, String zoneId) static InstantgetStartOfMonthInZoneId(String zoneId) static InstantgetStartOfMonthInZoneId(Instant when, String zoneId) static InstantgetStartOfTodayInZoneId(String zoneId) static InstantgetStartOfYearInZoneId(String zoneId) static InstantgetStartOfYearInZoneId(Instant when, String zoneId) static BigDecimalgetValueAsBigDecimal(Object value) Type-safely make a BigDecimal from any Object.static BooleangetValueAsBoolean(Object value) Returns null for null input; Returns the input object for Boolean-typed inputs.static byte[]getValueAsByteArray(Object value) static SerializablegetValueAsFieldType(QFieldType type, Object value) static InstantgetValueAsInstant(Object value) Type-safely make an Instant from any Object.static IntegergetValueAsInteger(Object value) Type-safely make an Integer from any Object.static LocalDategetValueAsLocalDate(Object value) Type-safely make a LocalDate from any Object.static LocalDateTimegetValueAsLocalDateTime(Object value) Type-safely make a LocalDateTime from any Object.static LocalTimegetValueAsLocalTime(Object value) static LonggetValueAsLong(Object value) Type-safely make an Long from any Object.static MapgetValueAsMap(Serializable value) static StringgetValueAsString(Object value) Type-safely make a String from any Object.static <T extends Serializable>
TgetValueAsType(Class<T> type, Object value) static QFieldTypeinferQFieldTypeFromValue(Serializable value, QFieldType defaultIfCannotInfer)
-
Constructor Details
-
ValueUtils
public ValueUtils()
-
-
Method Details
-
getValueAsString
-
getValueAsBoolean
-
getValueAsLong
Type-safely make an Long from any Object. null and empty-string inputs return null. We try to strip away commas and decimals (as long as they are exactly equal to the int value) We may throw if the input can't be converted to an integer.- Throws:
QValueException
-
getValueAsInteger
Type-safely make an Integer from any Object. null and empty-string inputs return null. We try to strip away commas and decimals (as long as they are exactly equal to the int value) We may throw if the input can't be converted to an integer.- Throws:
QValueException
-
getValueAsLocalDateTime
Type-safely make a LocalDateTime from any Object. null and empty-string inputs return null. We may throw if the input can't be converted to a LocalDateTime- Throws:
QValueException
-
getValueAsLocalDate
Type-safely make a LocalDate from any Object. null and empty-string inputs return null. We may throw if the input can't be converted to a LocalDate- Throws:
QValueException
-
getValueAsBigDecimal
Type-safely make a BigDecimal from any Object. null and empty-string inputs return null. We may throw if the input can't be converted to a BigDecimal- Throws:
QValueException
-
getValueAsInstant
-
getValueAsLocalTime
-
getValueAsByteArray
-
getValueAsType
-
getValueAsFieldType
-
getStartOfTodayInZoneId
-
getStartOfDayInZoneId
-
getStartOfMonthInZoneId
-
getStartOfMonthInZoneId
-
getStartOfYearInZoneId
-
getStartOfYearInZoneId
-
getFirstNonNull
Return the first argument that isn't null. If all were null, return null. -
getSessionOrInstanceZoneId
Get the (time) zoneId either for the current user session (based on session value UserTimezone or UserTimezoneOffsetMinutes), else the instance's defaultTimeZoneId string. -
inferQFieldTypeFromValue
public static QFieldType inferQFieldTypeFromValue(Serializable value, QFieldType defaultIfCannotInfer) -
getValueAsMap
-