@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 |
formatLong(java.lang.Long value)
Format Long using
integerFormat 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.lang.Long |
parseLong(java.lang.String str)
Parse Long using
integerFormat 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 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.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