Code example for Constructor

Methods: isAccessible, newInstance, setAccessible

0
     * @return An instance of the class 
     */ 
    public T createInstance(Object... params) {
      try { 
        boolean accessible = true;
        if(!constructor.isAccessible()){
          accessible = false;
          constructor.setAccessible(true);
        } 
        T rtn = constructor.newInstance(params);
        if(!accessible){ constructor.setAccessible(false); }
        return rtn;
      } catch (Exception e) {
        throw new ClassCreationException(e);
      } 
    } 
 
    /** 
     * Returns the full class name for the objects being produced 
     *  
     * @return The class name for the objects produced