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

		T t = null;

		try {
			if (parameterTypes != null && paramValue != null) {
				Constructor<T> constructor = clazz
						.getDeclaredConstructor(parameterTypes);
				Object[] obj = new Object[parameterTypes.length];

				System.arraycopy(paramValue, 0, obj, 0, parameterTypes.length);
				constructor.setAccessible(accessible);
				t = constructor.newInstance(obj);
			}

		} 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 (InstantiationException e) {
			log.error("{}",e.getMessage(),e);
		} catch (IllegalAccessException 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,
			Class<?>[] parameterTypes, Object[] paramValue) {
		if (clazz == null)
			return null;

		T t = null;

		try {
			if (parameterTypes != null && paramValue != null) {
				Constructor<T> constructor = clazz
						.getDeclaredConstructor(parameterTypes);
				Object[] obj = new Object[parameterTypes.length];

				System.arraycopy(paramValue, 0, obj, 0, parameterTypes.length);
				constructor.setAccessible(accessible);
				t = constructor.newInstance(obj);
			}

		} 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 (InstantiationException e) {
			log.error("{}",e.getMessage(),e);
		} catch (IllegalAccessException 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 , Class < ? > [ ] parameterTypes , Object [ ] paramValue ) { if ( clazz == null ) return null ; T t = null ; try { if ( parameterTypes != null && paramValue != null ) { Constructor < T > constructor = clazz . getDeclaredConstructor ( parameterTypes ) ; Object [ ] obj = new Object [ parameterTypes . length ] ; System . arraycopy ( paramValue , 0 , obj , 0 , parameterTypes . length ) ; constructor . setAccessible ( accessible ) ; t = constructor . newInstance ( obj ) ; } } 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 ( InstantiationException e ) { log . error ( "{}" , e . getMessage ( ) , e ) ; } catch ( IllegalAccessException 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 parameterTypes parameter types
@param paramValue param value
@param <T> t
@return instance
Create new instance of specified class and type