get Declared Fields from generic type - Java Reflection

Java examples for Reflection:Generic

Description

get Declared Fields from generic type

Demo Code


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

public class Main {
    public static <T> Field[] getDeclaredFields(T item) {
        return item.getClass().getDeclaredFields();
    }/*w w w  .  j a v a2s. c o m*/
}

Related Tutorials