Package org.omnifaces.converter
Class TrimConverter
- java.lang.Object
-
- org.omnifaces.converter.TrimConverter
-
- Direct Known Subclasses:
ToLowerCaseConverter,ToUpperCaseConverter
public class TrimConverter extends Object implements Converter<String>
The
omnifaces.TrimConverteris intented to trim any whitespace from submittedStringvalues. This keeps the data store free of whitespace pollution.This converter does by design no conversion in
getAsString().Usage
This converter is available by converter ID
omnifaces.TrimConverter. Just specify it in theconverterattribute of the component referring theStringproperty. For example:<h:inputText value="#{bean.username}" converter="omnifaces.TrimConverter" />You can also configure it application wide via below entry in
faces-config.xmlwithout the need to specify it in every single input component:<converter> <converter-for-class>java.lang.String</converter-for-class> <converter-class>org.omnifaces.converter.TrimConverter</converter-class> </converter>- Since:
- 2.6
- Author:
- Bauke Scholtz
-
-
Field Summary
-
Fields inherited from interface jakarta.faces.convert.Converter
DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
-
-
Constructor Summary
Constructors Constructor Description TrimConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAsObject(FacesContext context, UIComponent component, String submittedValue)StringgetAsString(FacesContext context, UIComponent component, String modelValue)
-
-
-
Method Detail
-
getAsObject
public String getAsObject(FacesContext context, UIComponent component, String submittedValue)
- Specified by:
getAsObjectin interfaceConverter<String>
-
getAsString
public String getAsString(FacesContext context, UIComponent component, String modelValue)
- Specified by:
getAsStringin interfaceConverter<String>
-
-