@Component(value="ui_NumberFormatter") @Scope(value="prototype") public class NumberFormatter extends java.lang.Object implements Formatter<java.lang.Number>
This formatter formats the Number
value into a string depending on the format string.
Modifier and Type | Field and Description |
---|---|
protected io.jmix.core.security.CurrentAuthentication |
currentAuthentication |
protected io.jmix.core.metamodel.datatype.DatatypeRegistry |
datatypeRegistry |
protected java.lang.String |
format |
protected io.jmix.core.metamodel.datatype.FormatStringsRegistry |
formatStringsRegistry |
protected io.jmix.core.Messages |
messages |
Constructor and Description |
---|
NumberFormatter() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
apply(java.lang.Number value)
Formats a value to a string.
|
void |
setFormat(java.lang.String format)
Sets the format string describing the number format which will be used to create
DecimalFormat instance. |
protected java.lang.String format
@Autowired protected io.jmix.core.security.CurrentAuthentication currentAuthentication
@Autowired protected io.jmix.core.Messages messages
@Autowired protected io.jmix.core.metamodel.datatype.DatatypeRegistry datatypeRegistry
@Autowired protected io.jmix.core.metamodel.datatype.FormatStringsRegistry formatStringsRegistry
@StudioProperty(type=LOCALIZED_STRING) public void setFormat(java.lang.String format)
DecimalFormat
instance.
It can be either a format string, or a key in message group.format
- a format string or a key in message group@Nullable public java.lang.String apply(@Nullable java.lang.Number value)
Formatter