Code example for Constructor

Methods: getNamenewInstance

0
 
  public static final Object createInstance(Constructor<?> cstr, Object ... cstrArgs) 
      throws RuntimeException 
  { 
    try { 
        return cstr.newInstance(cstrArgs);
    } catch (Exception e) {
      Throwable t = e;
      if (t instanceof InvocationTargetException) {
        t = ((InvocationTargetException) t).getTargetException();
      } 
      if (t instanceof Error) {
        throw (Error) t;
      } 
      if (t instanceof RuntimeException) {
        throw (RuntimeException) t;
      } 
      throw new RuntimeException("can not create instance of "+cstr.getName(), t);
    } 
  } 
   
    /** 
     * @throws JogampRuntimeException if the constructor can not be delivered.