Created
May 4, 2012 09:46
-
-
Save jhiemer/2593664 to your computer and use it in GitHub Desktop.
UUIDConverter plugged..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Either the user's pre-configured {@link ConversionService} or the | |
* {@link DefaultConversionService}. | |
* | |
* @return | |
*/ | |
@Bean | |
ConversionService conversionService() { | |
if (null != customConversionService) { | |
return customConversionService; | |
} else { | |
defaultConversionService.addConverter(new StringToUUIDConverter()); | |
return defaultConversionService; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringToUUIDConverter implements Converter<String, UUID> { | |
public UUID convert(String source) { | |
if (source != null) | |
return UUID.fromString(source); | |
else | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment