Package io.jmix.core.metamodel.datatype
Class DatatypeFormatter
java.lang.Object
io.jmix.core.metamodel.datatype.DatatypeFormatter
Convenience bean for locale-dependent conversion of some widely used data types to and from strings.
For locale-independent conversion use Datatype
methods directly.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionformatBigDecimal
(BigDecimal value) Format BigDecimal usingdecimalFormat
string specified in the main message group.formatBoolean
(Boolean value) Format Boolean usingtrueString
andfalseString
strings specified in the main message group.formatDate
(Date value) Format Date (date without time) usingdateFormat
string specified in the main message group.formatDateTime
(Date value) Format Date (date and time) usingdateTimeFormat
string specified in the main message group.formatDouble
(Double value) Format Double usingdoubleFormat
string specified in the main message group.formatInteger
(Integer value) Format Integer usingintegerFormat
string specified in the main message group.formatLocalDate
(LocalDate value) Format LocalDate (date without time and without a time-zone) usingdateFormat
string specified in the main message group.formatLocalDateTime
(LocalDateTime value) Format LocalDateTime (date and time without a time-zone) usingdateTimeFormat
string specified in the main message group.formatLocalTime
(LocalTime value) Format LocalTime (time without date and without a time-zone) usingtimeFormat
string specified in the main message group.formatLong
(Long value) Format Long usingintegerFormat
string specified in the main message group.Format OffsetDateTime (date and time with an offset from UTC/Greenwich) usingoffsetDateTimeFormat
string specified in the main message group.formatOffsetTime
(OffsetTime value) Format OffsetTime (time with an offset from UTC/Greenwich) usingoffsetTimeFormat
string specified in the main message group.formatTime
(Date value) Format Date (time without date) usingtimeFormat
string specified in the main message group.parseBigDecimal
(String str) Parse BigDecimal usingdecimalFormat
string specified in the main message group.parseBoolean
(String str) Parse Boolean usingtrueString
andfalseString
strings specified in the main message group.Parse Date (date without time) usingdateFormat
string specified in the main message group.parseDateTime
(String str) Parse Date (date and time) usingdateTimeFormat
string specified in the main message group.parseDouble
(String str) Parse Double usingdoubleFormat
string specified in the main message group.parseInteger
(String str) Parse Integer usingintegerFormat
string specified in the main message group.parseLocalDate
(String str) Parse LocalDate (date without time and without a time-zone) usingdateFormat
string specified in the main message group.parseLocalDateTime
(String str) Parse LocalDateTime (date and time without a time-zone) usingdateTimeFormat
string specified in the main message group.parseLocalTime
(String str) Parse LocalTime (time without date and without a time-zone) usingtimeFormat
string specified in the main message group.Parse Long usingintegerFormat
string specified in the main message group.Parse OffsetDateTime (date and time with an offset from UTC/Greenwich) usingoffsetDateTimeFormat
string specified in the main message group.parseOffsetTime
(String str) Parse OffsetTime (time without date and with an offset from UTC/Greenwich) usingoffsetTimeFormat
string specified in the main message group.Parse Date (time without date) usingtimeFormat
string specified in the main message group.
-
Field Details
-
currentAuthentication
-
datatypeRegistry
-
-
Constructor Details
-
DatatypeFormatter
public DatatypeFormatter()
-
-
Method Details
-
formatDate
Format Date (date without time) usingdateFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatTime
Format Date (time without date) usingtimeFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatDateTime
Format Date (date and time) usingdateTimeFormat
string specified in the main message group.Takes into account time zone if it is set for the current user session.
- Returns:
- string representation or empty string if the value is null
-
formatLocalDate
Format LocalDate (date without time and without a time-zone) usingdateFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatLocalDateTime
Format LocalDateTime (date and time without a time-zone) usingdateTimeFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatLocalTime
Format LocalTime (time without date and without a time-zone) usingtimeFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatOffsetDateTime
Format OffsetDateTime (date and time with an offset from UTC/Greenwich) usingoffsetDateTimeFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatOffsetTime
Format OffsetTime (time with an offset from UTC/Greenwich) usingoffsetTimeFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatDouble
Format Double usingdoubleFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatBigDecimal
Format BigDecimal usingdecimalFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatBoolean
Format Boolean usingtrueString
andfalseString
strings specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatInteger
Format Integer usingintegerFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
formatLong
Format Long usingintegerFormat
string specified in the main message group.- Returns:
- string representation or empty string if the value is null
-
parseDate
Parse Date (date without time) usingdateFormat
string specified in the main message group.- Returns:
- Date value or null if a blank string is provided
- Throws:
ParseException
-
parseTime
Parse Date (time without date) usingtimeFormat
string specified in the main message group.- Returns:
- Date value or null if a blank string is provided
- Throws:
ParseException
-
parseDateTime
Parse Date (date and time) usingdateTimeFormat
string specified in the main message group.Takes into account time zone if it is set for the current user session.
- Returns:
- Date value or null if a blank string is provided
- Throws:
ParseException
-
parseLocalDate
Parse LocalDate (date without time and without a time-zone) usingdateFormat
string specified in the main message group.- Returns:
- LocalDate value or null if a blank string is provided
- Throws:
ParseException
-
parseLocalTime
Parse LocalTime (time without date and without a time-zone) usingtimeFormat
string specified in the main message group.- Returns:
- LocalTime value or null if a blank string is provided
- Throws:
ParseException
-
parseLocalDateTime
Parse LocalDateTime (date and time without a time-zone) usingdateTimeFormat
string specified in the main message group.- Returns:
- LocalDateTime value or null if a blank string is provided
- Throws:
ParseException
-
parseOffsetDateTime
Parse OffsetDateTime (date and time with an offset from UTC/Greenwich) usingoffsetDateTimeFormat
string specified in the main message group.- Returns:
- OffsetDateTime value or null if a blank string is provided
- Throws:
ParseException
-
parseOffsetTime
Parse OffsetTime (time without date and with an offset from UTC/Greenwich) usingoffsetTimeFormat
string specified in the main message group.- Returns:
- OffsetTime value or null if a blank string is provided
- Throws:
ParseException
-
parseDouble
Parse Double usingdoubleFormat
string specified in the main message group.- Returns:
- Double value or null if a blank string is provided
- Throws:
ParseException
-
parseBigDecimal
Parse BigDecimal usingdecimalFormat
string specified in the main message group.- Returns:
- BigDecimal value or null if a blank string is provided
- Throws:
ParseException
-
parseBoolean
Parse Boolean usingtrueString
andfalseString
strings specified in the main message group.- Returns:
- Boolean value or null if a blank string is provided
- Throws:
ParseException
-
parseInteger
Parse Integer usingintegerFormat
string specified in the main message group.- Returns:
- Integer value or null if a blank string is provided
- Throws:
ParseException
-
parseLong
Parse Long usingintegerFormat
string specified in the main message group.- Returns:
- Long value or null if a blank string is provided
- Throws:
ParseException
-