<commit_before>package com.devskiller.friendly_id.spring;

import java.util.UUID;

import com.fasterxml.jackson.databind.Module;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.devskiller.friendly_id.FriendlyId;
import com.devskiller.friendly_id.jackson.FriendlyIdModule;

@Configuration
public class FriendlyIdConfiguration extends WebMvcConfigurerAdapter {

	@Override
	public void addFormatters(FormatterRegistry registry) {
		registry.addConverter(new StringToUuidConverter());
		super.addFormatters(registry);
	}

	@Bean
	public Module friendlyIdModule() {
		return new FriendlyIdModule();
	}

	//FIXME: make this public
	public static class StringToUuidConverter implements Converter<String, UUID> {

		@Override
		public UUID convert(String id) {
			return FriendlyId.toUuid(id);
		}
	}
}<commit_msg>Add UUID to string Spring converter<commit_after>package com.devskiller.friendly_id.spring;

import java.util.UUID;

import com.fasterxml.jackson.databind.Module;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.devskiller.friendly_id.FriendlyId;
import com.devskiller.friendly_id.jackson.FriendlyIdModule;

@Configuration
public class FriendlyIdConfiguration extends WebMvcConfigurerAdapter {

	@Override
	public void addFormatters(FormatterRegistry registry) {
		registry.addConverter(new StringToUuidConverter());
		registry.addConverter(new UuidToStringConverter());
		super.addFormatters(registry);
	}

	@Bean
	public Module friendlyIdModule() {
		return new FriendlyIdModule();
	}

	//FIXME: make this public
	public static class StringToUuidConverter implements Converter<String, UUID> {

		@Override
		public UUID convert(String id) {
			return FriendlyId.toUuid(id);
		}
	}


	public static class UuidToStringConverter implements Converter<UUID, String> {

		@Override
		public String convert(UUID id) {
			return FriendlyId.toFriendlyId(id);
		}
	}
}
{'fraction_non_alphanumeric': 0.08616404308202154, 'fraction_numerical': 0.0, 'mean_word_length': 6.274096385542169, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2567409', 'n_tokens_mistral': 722, 'n_tokens_neox': 682, 'n_words': 139}