public class StringToUuidConverter extends Object implements Converter<String,UUID>
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
| Constructor and Description |
|---|
StringToUuidConverter(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.
|
| Modifier and Type | Method and Description |
|---|---|
Result<UUID> |
convertToModel(String value,
ValueContext context)
Converts the given value from presentation type to model type.
|
String |
convertToPresentation(UUID value,
ValueContext context)
Converts the given value from model type to presentation type.
|
public StringToUuidConverter(String errorMessage)
errorMessage - the error message to use if conversion failspublic StringToUuidConverter(ErrorMessageProvider errorMessageProvider)
null.errorMessageProvider - the error message provider to use if conversion failspublic Result<UUID> convertToModel(String value, ValueContext context)
ConverterA converter can optionally use locale to do the conversion.
convertToModel in interface Converter<String,UUID>value - The value to convert. Can be nullcontext - The value context for the conversion.public String convertToPresentation(UUID value, ValueContext context)
ConverterA converter can optionally use locale to do the conversion.
convertToPresentation in interface Converter<String,UUID>value - The value to convert. Can be nullcontext - The value context for the conversion.Copyright © 2020. All rights reserved.