Java Reflection Generic Type from Class getGenericParameterClass(Class actualClass, int parameterIndex)

Here you can find the source of getGenericParameterClass(Class actualClass, int parameterIndex)

Description

get Generic Parameter Class

License

Open Source License

Declaration

public static Class getGenericParameterClass(Class actualClass, int parameterIndex) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.ParameterizedType;

public class Main {
    public static Class getGenericParameterClass(Class actualClass, int parameterIndex) {
        return (Class) ((ParameterizedType) actualClass.getGenericSuperclass())
                .getActualTypeArguments()[parameterIndex];
    }/*from www .java 2s  .  c  o  m*/
}

Related

  1. getGenericInterface(final Class sourceClass, final Class genericInterface)
  2. getGenericInterfaceParamType(Class cls, Class rawType)
  3. getGenericInterfacesActualTypes(Collection types, Class aClass)
  4. getGenericParameter(Class clazz, int index)
  5. getGenericParameter(Type class1, int number)
  6. getGenericParameterClass(Class clazz)
  7. getGenericParameters(Class clazz)
  8. getGenericParameterType(Class clazz, Integer parameterIndex)
  9. getGenericParameterType0(Class cls, Class genericSuper, int paramIndex)