get Generic Types - Java Reflection

Java examples for Reflection:Generic

Description

get Generic Types

Demo Code

// This program is free software: you can redistribute it and/or modify
//package com.java2s;
import java.lang.reflect.*;

public class Main {
    public static Type[] getGenericTypes(ParameterizedType t) {
        if (t == null)
            return new Type[] {};
        else/*w ww .  j a v  a 2s .c  o m*/
            return t.getActualTypeArguments();
    }
}

Related Tutorials