public class ImplicitNumberConverter extends NumberConverter
This converter won't output the percent or currency symbols, that's up to the UI. This converter will implicitly infer percent or currency symbols on submitted value when absent, just to prevent an unnecessary conversion error.
This converter is available by converter ID omnifaces.ImplicitNumberConverter
. Just specify it as
<o:converter>
nested in the component referring the Number
property. For example:
<span class="currency"> <span class="symbol">$</span> <h:inputText value="#{bean.price}"> <o:converter converterId="omnifaces.ImplicitNumberConverter" type="currency" currencySymbol="$" /> </h:inputText> </span>
CONVERTER_ID, CURRENCY_ID, NUMBER_ID, PATTERN_ID, PERCENT_ID, STRING_ID
DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
Constructor and Description |
---|
ImplicitNumberConverter() |
Modifier and Type | Method and Description |
---|---|
Object |
getAsObject(FacesContext context,
UIComponent component,
String submittedValue) |
String |
getAsString(FacesContext context,
UIComponent component,
Object modelValue) |
clearInitialState, getCurrencyCode, getCurrencySymbol, getLocale, getMaxFractionDigits, getMaxIntegerDigits, getMinFractionDigits, getMinIntegerDigits, getPattern, getType, initialStateMarked, isGroupingUsed, isIntegerOnly, isTransient, markInitialState, restoreState, saveState, setCurrencyCode, setCurrencySymbol, setGroupingUsed, setIntegerOnly, setLocale, setMaxFractionDigits, setMaxIntegerDigits, setMinFractionDigits, setMinIntegerDigits, setPattern, setTransient, setType
public String getAsString(FacesContext context, UIComponent component, Object modelValue)
getAsString
in interface Converter
getAsString
in class NumberConverter
public Object getAsObject(FacesContext context, UIComponent component, String submittedValue)
getAsObject
in interface Converter
getAsObject
in class NumberConverter
Copyright © 2012–2020 OmniFaces. All rights reserved.