src/main/java/com/googlecode/objectify/impl/TypeUtils.java
public static MethodHandle getConstructor(Class<?> clazz, Class<?>... args) {
		try {
			// We use unreflect so that we can make the constructor accessible
			Constructor<?> ctor = clazz.getDeclaredConstructor(args);
			ctor.setAccessible(true);
			return MethodHandles.lookup().unreflectConstructor(ctor);
		}
		catch (NoSuchMethodException e) {
			throw new IllegalStateException(clazz.getName() + " has no constructor with args " + Arrays.toString(args), e);
		} catch (IllegalAccessException e) {
			throw new IllegalStateException("Problem getting constructor for " + clazz.getName() + " with args " + Arrays.toString(args), e);
		}
	}
public static MethodHandle getConstructor(Class<?> clazz, Class<?>... args) {
		try {
			// We use unreflect so that we can make the constructor accessible
			Constructor<?> ctor = clazz.getDeclaredConstructor(args);
			ctor.setAccessible(true);
			return MethodHandles.lookup().unreflectConstructor(ctor);
		}
		catch (NoSuchMethodException e) {
			throw new IllegalStateException(clazz.getName() + " has no constructor with args " + Arrays.toString(args), e);
		} catch (IllegalAccessException e) {
			throw new IllegalStateException("Problem getting constructor for " + clazz.getName() + " with args " + Arrays.toString(args), e);
		}
	}
public static MethodHandle getConstructor ( Class < ? > clazz , Class < ? > ... args ) { try { // We use unreflect so that we can make the constructor accessible Constructor < ? > ctor = clazz . getDeclaredConstructor ( args ) ; ctor . setAccessible ( true ) ; return MethodHandles . lookup ( ) . unreflectConstructor ( ctor ) ; } catch ( NoSuchMethodException e ) { throw new IllegalStateException ( clazz . getName ( ) + " has no constructor with args " + Arrays . toString ( args ) , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalStateException ( "Problem getting constructor for " + clazz . getName ( ) + " with args " + Arrays . toString ( args ) , e ) ; } }
Gets a constructor that has the specified types of arguments.
Throw an IllegalStateException if the class does not have such a constructor.
Gets a constructor that has the specified types of arguments . Throw an IllegalStateException if the class does not have such a constructor .