Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class Main {
    private static Class<?> getEntityClass(Field field) {
        Type genType = field.getGenericType();
        if (genType instanceof ParameterizedType) {
            ParameterizedType pt = (ParameterizedType) genType;
            Type type = pt.getActualTypeArguments()[0];
            return (Class<?>) type;
        }
        return null;
    }
}