public static < T > T newInstance ( Class < T > clazz ) { // TODO(yanivi): investigate "sneaky" options for allocating the class that GSON uses, like // setting the constructor to be accessible, or possibly provide a factory method of a special // name try { return clazz . newInstance ( ) ; } catch ( IllegalAccessException e ) { throw handleExceptionForNewInstance ( e , clazz ) ; } catch ( InstantiationException e ) { throw handleExceptionForNewInstance ( e , clazz ) ; } }
Creates a new instance of the given class by invoking its default constructor .