com.vaadin.flow.data.converter.
Class StringToUuidConverter
All Implemented Interfaces:
A converter that converts from String
to UUID
and back.
Leading and trailing white spaces are ignored when converting from a String.
The String representation uses the canonical format of 32-characters with a hyphen to separate each of five groups of hexadecimal digits as defined in: RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace http://www.ietf.org/rfc/rfc4122.txt
Author:
Vaadin Ltd
See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStringToUuidConverter
(ErrorMessageProvider errorMessageProvider) Constructs a new converter instance with the given error message provider.
StringToUuidConverter
(String errorMessage) Constructs a converter for String to UUID and back.
-
Method Summary
Modifier and TypeMethodDescriptionconvertToModel
(String value, ValueContext context) Converts the given value from presentation type to model type.
convertToPresentation
(UUID value, ValueContext context) Converts the given value from model type to presentation type.
-
Constructor Details
-
StringToUuidConverter
Constructs a converter for String to UUID and back.
Parameters:
errorMessage
- the error message to use if conversion fails -
StringToUuidConverter
Constructs a new converter instance with the given error message provider. Empty strings are converted to
null
.Parameters:
errorMessageProvider
- the error message provider to use if conversion fails
-
-
Method Details
-
convertToModel
Description copied from interface:
Converter
Converts the given value from presentation type to model type.
A converter can optionally use locale to do the conversion.
Specified by:
convertToModel
in interfaceConverter<String,
UUID> Parameters:
value
- The value to convert. Can be nullcontext
- The value context for the conversion.Returns:
The converted value compatible with the source type
-
convertToPresentation
Description copied from interface:
Converter
Converts the given value from model type to presentation type.
A converter can optionally use locale to do the conversion.
Specified by:
convertToPresentation
in interfaceConverter<String,
UUID> Parameters:
value
- The value to convert. Can be nullcontext
- The value context for the conversion.Returns:
The converted value compatible with the source type
-