private T createEmpty ( Class < ? > clazz ) { T emptyInstance = null ; if ( clazz . isInterface ( ) ) { throw new IllegalArgumentException ( "Specified class is an interface: " + clazz . getName ( ) ) ; } try { emptyInstance = ( T ) clazz . newInstance ( ) ; } catch ( InstantiationException ex ) { throw new IllegalArgumentException ( clazz . getName ( ) + ". Is it an abstract class?" , ex ) ; } catch ( IllegalAccessException ex ) { throw new IllegalArgumentException ( clazz . getName ( ) + "Is the constructor accessible?" , ex ) ; } return emptyInstance ; }
Creates new empty Bean instance