@Component(value="cuba_DatatypeFormatter")
public class DatatypeFormatter
extends java.lang.Object
For locale-independent conversion use Datatype
methods directly.
Modifier and Type | Field and Description |
---|---|
protected DatatypeRegistry |
datatypeRegistry |
static java.lang.String |
NAME |
protected UserSessionSource |
uss |
Constructor and Description |
---|
DatatypeFormatter() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
formatBigDecimal(java.math.BigDecimal value)
Format BigDecimal using
decimalFormat string specified in the main message pack. |
java.lang.String |
formatBoolean(java.lang.Boolean value)
Format Boolean using
trueString and falseString strings specified in the main message pack. |
java.lang.String |
formatDate(java.util.Date value)
Format Date (date without time) using
dateFormat string specified in the main message pack. |
java.lang.String |
formatDateTime(java.util.Date value)
Format Date (date and time) using
dateTimeFormat string specified in the main message pack. |
java.lang.String |
formatDouble(java.lang.Double value)
Format Double using
doubleFormat string specified in the main message pack. |
java.lang.String |
formatInteger(java.lang.Integer value)
Format Integer using
integerFormat string specified in the main message pack. |
java.lang.String |
formatLocalDate(java.time.LocalDate value)
Format LocalDate (date without time and without a time-zone) using
dateFormat string specified in the
main message pack. |
java.lang.String |
formatLocalDateTime(java.time.LocalDateTime value)
Format LocalDateTime (date and time without a time-zone) using
dateTimeFormat string specified in the
main message pack. |
java.lang.String |
formatLocalTime(java.time.LocalTime value)
Format LocalTime (time without date and without a time-zone) using
timeFormat string specified in the
main message pack. |
java.lang.String |
formatLong(java.lang.Long value)
Format Long using
integerFormat string specified in the main message pack. |
java.lang.String |
formatOffsetDateTime(java.time.OffsetDateTime value)
Format OffsetDateTime (date and time with an offset from UTC/Greenwich) using
offsetDateTimeFormat string
specified in the main message pack. |
java.lang.String |
formatOffsetTime(java.time.OffsetTime value)
Format OffsetTime (time with an offset from UTC/Greenwich) using
offsetTimeFormat string specified in the
main message pack. |
java.lang.String |
formatTime(java.util.Date value)
Format Date (time without date) using
timeFormat string specified in the main message pack. |
java.math.BigDecimal |
parseBigDecimal(java.lang.String str)
Parse BigDecimal using
decimalFormat string specified in the main message pack. |
java.lang.Boolean |
parseBoolean(java.lang.String str)
Parse Boolean using
trueString and falseString strings specified in the main message pack. |
java.util.Date |
parseDate(java.lang.String str)
Parse Date (date without time) using
dateFormat string specified in the main message pack. |
java.util.Date |
parseDateTime(java.lang.String str)
Parse Date (date and time) using
dateTimeFormat string specified in the main message pack. |
java.lang.Double |
parseDouble(java.lang.String str)
Parse Double using
doubleFormat string specified in the main message pack. |
java.lang.Integer |
parseInteger(java.lang.String str)
Parse Integer using
integerFormat string specified in the main message pack. |
java.time.LocalDate |
parseLocalDate(java.lang.String str)
Parse LocalDate (date without time and without a time-zone) using
dateFormat string specified in the main
message pack. |
java.time.LocalDateTime |
parseLocalDateTime(java.lang.String str)
Parse LocalDateTime (date and time without a time-zone) using
dateTimeFormat string specified in the main
message pack. |
java.time.LocalTime |
parseLocalTime(java.lang.String str)
Parse LocalTime (time without date and without a time-zone) using
timeFormat string specified in the main
message pack. |
java.lang.Long |
parseLong(java.lang.String str)
Parse Long using
integerFormat string specified in the main message pack. |
java.time.OffsetDateTime |
parseOffsetDateTime(java.lang.String str)
Parse OffsetDateTime (date and time with an offset from UTC/Greenwich) using
offsetDateTimeFormat string
specified in the main message pack. |
java.time.OffsetTime |
parseOffsetTime(java.lang.String str)
Parse OffsetTime (time without date and with an offset from UTC/Greenwich) using
offsetTimeFormat string
specified in the main message pack. |
java.util.Date |
parseTime(java.lang.String str)
Parse Date (time without date) using
timeFormat string specified in the main message pack. |
public static final java.lang.String NAME
@Inject protected UserSessionSource uss
@Inject protected DatatypeRegistry datatypeRegistry
public java.lang.String formatDate(@Nullable java.util.Date value)
dateFormat
string specified in the main message pack.public java.lang.String formatTime(@Nullable java.util.Date value)
timeFormat
string specified in the main message pack.public java.lang.String formatDateTime(@Nullable java.util.Date value)
dateTimeFormat
string specified in the main message pack.
Takes into account time zone if it is set for the current user session.
public java.lang.String formatLocalDate(@Nullable java.time.LocalDate value)
dateFormat
string specified in the
main message pack.public java.lang.String formatLocalDateTime(@Nullable java.time.LocalDateTime value)
dateTimeFormat
string specified in the
main message pack.public java.lang.String formatLocalTime(@Nullable java.time.LocalTime value)
timeFormat
string specified in the
main message pack.public java.lang.String formatOffsetDateTime(@Nullable java.time.OffsetDateTime value)
offsetDateTimeFormat
string
specified in the main message pack.public java.lang.String formatOffsetTime(@Nullable java.time.OffsetTime value)
offsetTimeFormat
string specified in the
main message pack.public java.lang.String formatDouble(@Nullable java.lang.Double value)
doubleFormat
string specified in the main message pack.public java.lang.String formatBigDecimal(@Nullable java.math.BigDecimal value)
decimalFormat
string specified in the main message pack.public java.lang.String formatBoolean(@Nullable java.lang.Boolean value)
trueString
and falseString
strings specified in the main message pack.public java.lang.String formatInteger(@Nullable java.lang.Integer value)
integerFormat
string specified in the main message pack.public java.lang.String formatLong(@Nullable java.lang.Long value)
integerFormat
string specified in the main message pack.@Nullable public java.util.Date parseDate(java.lang.String str) throws java.text.ParseException
dateFormat
string specified in the main message pack.java.text.ParseException
@Nullable public java.util.Date parseTime(java.lang.String str) throws java.text.ParseException
timeFormat
string specified in the main message pack.java.text.ParseException
@Nullable public java.util.Date parseDateTime(java.lang.String str) throws java.text.ParseException
dateTimeFormat
string specified in the main message pack.
Takes into account time zone if it is set for the current user session.
java.text.ParseException
@Nullable public java.time.LocalDate parseLocalDate(java.lang.String str) throws java.text.ParseException
dateFormat
string specified in the main
message pack.java.text.ParseException
@Nullable public java.time.LocalTime parseLocalTime(java.lang.String str) throws java.text.ParseException
timeFormat
string specified in the main
message pack.java.text.ParseException
@Nullable public java.time.LocalDateTime parseLocalDateTime(java.lang.String str) throws java.text.ParseException
dateTimeFormat
string specified in the main
message pack.java.text.ParseException
@Nullable public java.time.OffsetDateTime parseOffsetDateTime(java.lang.String str) throws java.text.ParseException
offsetDateTimeFormat
string
specified in the main message pack.java.text.ParseException
@Nullable public java.time.OffsetTime parseOffsetTime(java.lang.String str) throws java.text.ParseException
offsetTimeFormat
string
specified in the main message pack.java.text.ParseException
@Nullable public java.lang.Double parseDouble(java.lang.String str) throws java.text.ParseException
doubleFormat
string specified in the main message pack.java.text.ParseException
@Nullable public java.math.BigDecimal parseBigDecimal(java.lang.String str) throws java.text.ParseException
decimalFormat
string specified in the main message pack.java.text.ParseException
@Nullable public java.lang.Boolean parseBoolean(java.lang.String str) throws java.text.ParseException
trueString
and falseString
strings specified in the main message pack.java.text.ParseException
@Nullable public java.lang.Integer parseInteger(java.lang.String str) throws java.text.ParseException
integerFormat
string specified in the main message pack.java.text.ParseException
@Nullable public java.lang.Long parseLong(java.lang.String str) throws java.text.ParseException
integerFormat
string specified in the main message pack.java.text.ParseException