src/main/java/com/rockagen/commons/util/ClassUtil.java
public static <T> T getInstance(Class<T> clazz, boolean accessible) {
		if (clazz == null)
			return null;

		T t = null;

		try {
			Constructor<T> constructor = clazz.getDeclaredConstructor();
			constructor.setAccessible(accessible);
			t = constructor.newInstance();
		} catch (InstantiationException e) {
			log.error("{}",e.getMessage(),e);
		} catch (IllegalAccessException e) {
			log.error("{}",e.getMessage(),e);
		} catch (SecurityException e) {
			log.error("{}",e.getMessage(),e);
		} catch (NoSuchMethodException e) {
			log.error("{}",e.getMessage(),e);
		} catch (IllegalArgumentException e) {
			log.error("{}",e.getMessage(),e);
		} catch (InvocationTargetException e) {
			log.error("{}",e.getMessage(),e);
		}

		return t;
	}
public static <T> T getInstance(Class<T> clazz, boolean accessible) {
		if (clazz == null)
			return null;

		T t = null;

		try {
			Constructor<T> constructor = clazz.getDeclaredConstructor();
			constructor.setAccessible(accessible);
			t = constructor.newInstance();
		} catch (InstantiationException e) {
			log.error("{}",e.getMessage(),e);
		} catch (IllegalAccessException e) {
			log.error("{}",e.getMessage(),e);
		} catch (SecurityException e) {
			log.error("{}",e.getMessage(),e);
		} catch (NoSuchMethodException e) {
			log.error("{}",e.getMessage(),e);
		} catch (IllegalArgumentException e) {
			log.error("{}",e.getMessage(),e);
		} catch (InvocationTargetException e) {
			log.error("{}",e.getMessage(),e);
		}

		return t;
	}
Create new instance of specified class and type

@param clazz class
@param accessible accessible
@param <T> t
@return instance