private Object createInstance(Class pClass, Object pParam) {
    Object value;

    try {

      // Create param and argument arrays
      Class[]  param = { pParam.getClass() };
      Object[] arg   = { pParam };

      // Get constructor
      Constructor constructor = pClass.getDeclaredConstructor(param);

      // Invoke and create instance
      value = constructor.newInstance(arg);
    } catch (Exception e) {
      return null;
    }
    return value;
  }
private Object createInstance ( Class pClass , Object pParam ) { Object value ; try { Class [ ] param = { pParam . getClass ( ) } ; Object [ ] arg = { pParam } ; Constructor constructor = pClass . getDeclaredConstructor ( param ) ; value = constructor . newInstance ( arg ) ; } catch ( Exception e ) { return null ; } return value ; }
Creates an object from the given class' single argument constructor.

@return The object created from the constructor.
If the constructor could not be invoked for any reason, null is
returned.