spring.turbo.util.reflection.ConstructorUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-turbo Show documentation
Show all versions of spring-turbo Show documentation
Another enhancement library of SpringBoot/SpringFramework. Have fun.
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;
}
}
}