- java.lang.Object
-
- jakarta.faces.convert.NumberConverter
-
- org.omnifaces.converter.ImplicitNumberConverter
-
- All Implemented Interfaces:
PartialStateHolder
,StateHolder
,Converter
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.
Usage
This converter is available by converter ID
omnifaces.ImplicitNumberConverter
. Just specify it as<o:converter>
nested in the component referring theNumber
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>
- Since:
- 3.0
- Author:
- Bauke Scholtz
-
-
Field Summary
-
Fields inherited from class jakarta.faces.convert.NumberConverter
CONVERTER_ID, CURRENCY_ID, NUMBER_ID, PATTERN_ID, PERCENT_ID, STRING_ID
-
Fields inherited from interface jakarta.faces.convert.Converter
DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
-
-
Constructor Summary
Constructors Constructor Description ImplicitNumberConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getAsObject(FacesContext context, UIComponent component, String submittedValue)
String
getAsString(FacesContext context, UIComponent component, Object modelValue)
-
Methods inherited from class jakarta.faces.convert.NumberConverter
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
-
-
-
-
Method Detail
-
getAsString
public String getAsString(FacesContext context, UIComponent component, Object modelValue)
- Specified by:
getAsString
in interfaceConverter
- Overrides:
getAsString
in classNumberConverter
-
getAsObject
public Object getAsObject(FacesContext context, UIComponent component, String submittedValue)
- Specified by:
getAsObject
in interfaceConverter
- Overrides:
getAsObject
in classNumberConverter
-
-