Package com.vaadin.flow.data.converter
Class StringToBigIntegerConverter
java.lang.Object
com.vaadin.flow.data.converter.AbstractStringToNumberConverter<BigInteger>
com.vaadin.flow.data.converter.StringToBigIntegerConverter
- All Implemented Interfaces:
Converter<String,,BigInteger> Serializable
A converter that converts from
String to BigInteger and back.
Uses the given locale and a NumberFormat instance for formatting and
parsing.
Leading and trailing white spaces are ignored when converting from a String.
Override and overwrite getFormat(Locale) to use a different format.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStringToBigIntegerConverter(ErrorMessageProvider errorMessageProvider) Creates a new converter instance with the given error message provider.StringToBigIntegerConverter(String errorMessage) Creates a new converter instance with the given error message.StringToBigIntegerConverter(BigInteger emptyValue, ErrorMessageProvider errorMessageProvider) Creates a new converter instance with the given presentation value for empty string and error message provider.StringToBigIntegerConverter(BigInteger emptyValue, String errorMessage) Creates a new converter instance with the given presentation value for empty string and error message. -
Method Summary
Modifier and TypeMethodDescriptionconvertToModel(String value, ValueContext context) Converts the given value from presentation type to model type.protected NumberFormatReturns the format used byConverter.convertToPresentation(Object, ValueContext)andConverter.convertToModel(Object, ValueContext).Methods inherited from class com.vaadin.flow.data.converter.AbstractStringToNumberConverter
convertToNumber, convertToPresentation, getErrorMessage
-
Constructor Details
-
StringToBigIntegerConverter
Creates a new converter instance with the given error message. Empty strings are converted tonull.- Parameters:
errorMessage- the error message to use if conversion fails
-
StringToBigIntegerConverter
Creates a new converter instance with the given presentation value for empty string and error message.- Parameters:
emptyValue- the presentation value to return when converting an empty string, may benullerrorMessage- the error message to use if conversion fails
-
StringToBigIntegerConverter
Creates a new converter instance with the given error message provider. Empty strings are converted tonull.- Parameters:
errorMessageProvider- the error message provider to use if conversion fails
-
StringToBigIntegerConverter
public StringToBigIntegerConverter(BigInteger emptyValue, ErrorMessageProvider errorMessageProvider) Creates a new converter instance with the given presentation value for empty string and error message provider.- Parameters:
emptyValue- the presentation value to return when converting an empty string, may benullerrorMessageProvider- the error message provider to use if conversion fails
-
-
Method Details
-
getFormat
Description copied from class:AbstractStringToNumberConverterReturns the format used byConverter.convertToPresentation(Object, ValueContext)andConverter.convertToModel(Object, ValueContext).- Overrides:
getFormatin classAbstractStringToNumberConverter<BigInteger>- Parameters:
locale- The locale to use- Returns:
- A NumberFormat instance
-
convertToModel
Description copied from interface:ConverterConverts the given value from presentation type to model type.A converter can optionally use locale to do the conversion.
- Parameters:
value- The value to convert. Can be nullcontext- The value context for the conversion.- Returns:
- The converted value compatible with the source type
-