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

spring.turbo.util.reflection.ConstructorUtils Maven / Gradle / Ivy

There is a newer version: 3.3.3
Show newest version
package spring.turbo.util.reflection;

import org.springframework.lang.Nullable;
import org.springframework.util.ReflectionUtils;

import java.lang.reflect.Constructor;

/**
 * 反射工具 - 构造方法
 *
 * @author 应卓
 * @see MethodUtils
 * @see FieldUtils
 * @since 1.2.1
 */
public final class ConstructorUtils {

    /**
     * 私有构造方法
     */
    private ConstructorUtils() {
        super();
    }

    // -----------------------------------------------------------------------------------------------------------------

    public static  void makeAccessible(Constructor constructor) {
        ReflectionUtils.makeAccessible(constructor);
    }

    // -----------------------------------------------------------------------------------------------------------------

    @Nullable
    public static  Constructor accessibleConstructor(Class clazz, Class... parameterTypes) {
        try {
            return ReflectionUtils.accessibleConstructor(clazz, parameterTypes);
        } catch (NoSuchMethodException e) {
            return null;
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy