Example usage for java.lang.reflect Constructor getTypeParameters

List of usage examples for java.lang.reflect Constructor getTypeParameters

Introduction

In this page you can find the example usage for java.lang.reflect Constructor getTypeParameters.

Prototype

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public TypeVariable<Constructor<T>>[] getTypeParameters() 

Source Link

Usage

From source file:Main.java

public static void print_method_or_constructor(Member member) {
    Constructor c = (Constructor) member;
    TypeVariable[] parameters = c.getTypeParameters();

    for (int i = 0; i < parameters.length; i++) {
        System.out.println(parameters[i]);
    }//from  w w w .  j a va2 s . com
}

From source file:io.konik.utils.RandomInvoiceGenerator.java

private static Constructor<?> findBiggestConstructor(Class<?> root) {
    Constructor<?>[] constructors = root.getConstructors();
    Constructor<?> biggestConstructor = null;
    for (Constructor<?> constructor : constructors) {
        if (biggestConstructor == null) {
            biggestConstructor = constructor;
            continue;
        }/*from w w  w .  j a  v  a  2 s.c  om*/
        if (constructor.getTypeParameters().length > biggestConstructor.getParameterTypes().length) {
            biggestConstructor = constructor;
        }
    }
    return biggestConstructor;
}