<commit_before>package florian_haas.lucas.web;

import java.io.Serializable;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.spi.*;
import javax.faces.convert.Converter;
import javax.inject.Named;

import florian_haas.lucas.util.Utils;
import florian_haas.lucas.web.converter.EnumConverter;
import florian_haas.lucas.web.util.WebUtils;

@Named
@ApplicationScoped
public class ConverterBean implements Serializable {

	private static final long serialVersionUID = 5695265421704720573L;

	public static final String NULL_KEY = "lucas.application.converterBean.nullValue";

	public Converter getConverter(String converterId) {
		return WebUtils.getConverterFromId(converterId);
	}

	@SuppressWarnings({
			"unchecked", "rawtypes" })
	public Converter getManagedConverter(String converterId) {
		BeanManager manager = CDI.current().getBeanManager();
		Bean bean = manager.getBeans(converterId).iterator().next();
		return (Converter) manager.getReference(bean, bean.getBeanClass(), manager.createCreationalContext(bean));
	}

	public <E extends Enum<E>> String convertEnum(E enumValue) {
		return WebUtils.getAsString(enumValue, EnumConverter.CONVERTER_ID);
	}

	public String getAsString(Object object, String converterId) {
		return WebUtils.getAsString(object, converterId);
	}

	public String getStackTrace(Exception e) {
		return Utils.getStackTraceAsString(e);
	}
}<commit_msg>Made Converter in getConverter generic.<commit_after>package florian_haas.lucas.web;

import java.io.Serializable;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.spi.*;
import javax.faces.convert.Converter;
import javax.inject.Named;

import florian_haas.lucas.util.Utils;
import florian_haas.lucas.web.converter.EnumConverter;
import florian_haas.lucas.web.util.WebUtils;

@Named
@ApplicationScoped
public class ConverterBean implements Serializable {

	private static final long serialVersionUID = 5695265421704720573L;

	public static final String NULL_KEY = "lucas.application.converterBean.nullValue";

	public Converter<?> getConverter(String converterId) {
		return WebUtils.getConverterFromId(converterId);
	}

	@SuppressWarnings({
			"unchecked", "rawtypes" })
	public Converter getManagedConverter(String converterId) {
		BeanManager manager = CDI.current().getBeanManager();
		Bean bean = manager.getBeans(converterId).iterator().next();
		return (Converter) manager.getReference(bean, bean.getBeanClass(), manager.createCreationalContext(bean));
	}

	public <E extends Enum<E>> String convertEnum(E enumValue) {
		return WebUtils.getAsString(enumValue, EnumConverter.CONVERTER_ID);
	}

	public String getAsString(Object object, String converterId) {
		return WebUtils.getAsString(object, converterId);
	}

	public String getStackTrace(Exception e) {
		return Utils.getStackTraceAsString(e);
	}
}
{'fraction_non_alphanumeric': 0.09940497024851243, 'fraction_numerical': 0.013300665033251663, 'mean_word_length': 6.560846560846561, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '369531', 'n_tokens_mistral': 937, 'n_tokens_neox': 855, 'n_words': 176}