<commit_before>package org.treeleafj.xmax.bean;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * 泛型工具
 */
public class GenericUtils {

    private static Logger log = LoggerFactory.getLogger(GenericUtils.class);

    /**
     * 获取当前类的泛型类型
     *
     * @param obj
     * @return
     */
    public static Class getGenericFirst(Object obj) {
        Type type = (Type) obj.getClass().getGenericSuperclass();
        ParameterizedType pt = (ParameterizedType) type;
        Class classz = ((Class) pt.getActualTypeArguments()[0]);
        return classz;
    }

    /**
     * 获取当前类的多个泛型类型中的第index个
     *
     * @param obj
     * @param index
     * @return
     */
    public static Class getGeneric(Object obj, int index) {
        Type type = (Type) obj.getClass().getGenericSuperclass();
        ParameterizedType pt = (ParameterizedType) type;
        log.info("pt:" + pt);
        Class classz = ((Class) pt.getActualTypeArguments()[index]);
        return classz;
    }

}<commit_msg>去掉日志打印<commit_after>package org.treeleafj.xmax.bean;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * 泛型工具
 */
public class GenericUtils {

    private static Logger log = LoggerFactory.getLogger(GenericUtils.class);

    /**
     * 获取当前类的泛型类型
     *
     * @param obj
     * @return
     */
    public static Class getGenericFirst(Object obj) {
        Type type = obj.getClass().getGenericSuperclass();
        ParameterizedType pt = (ParameterizedType) type;
        Class classz = ((Class) pt.getActualTypeArguments()[0]);
        return classz;
    }

    /**
     * 获取当前类的多个泛型类型中的第index个
     *
     * @param obj
     * @param index
     * @return
     */
    public static Class getGeneric(Object obj, int index) {
        Type type = obj.getClass().getGenericSuperclass();
        ParameterizedType pt = (ParameterizedType) type;
        Class classz = ((Class) pt.getActualTypeArguments()[index]);
        return classz;
    }

}
{'fraction_non_alphanumeric': 0.11547562707051585, 'fraction_numerical': 0.002839564600094652, 'mean_word_length': 2.702276707530648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3523353', 'n_tokens_mistral': 691, 'n_tokens_neox': 695, 'n_words': 138}