All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deeplearning4j.util.Dl4jReflection Maven / Gradle / Ivy

package org.deeplearning4j.util;

import java.lang.reflect.Constructor;

/**
 * @author Adam Gibson
 */
public class Dl4jReflection {
    private Dl4jReflection() {}

    /**
     * Gets the empty constructor from a class
     * @param clazz the class to getFromOrigin the constructor from
     * @return the empty constructor for the class
     */
    public static Constructor getEmptyConstructor(Class clazz) {
        Constructor c = clazz.getDeclaredConstructors()[0];
        for(int i = 0; i < clazz.getDeclaredConstructors().length; i++) {
            if(clazz.getDeclaredConstructors()[i].getParameterTypes().length < 1) {
                c = clazz.getDeclaredConstructors()[i];
                break;
            }
        }

       return c;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy