public static boolean isInstancableClass ( @ Nullable final Class < ? > aClass ) { if ( ! isPublicClass ( aClass ) ) return false ; // Check if a default constructor is present try { aClass . getConstructor ( ( Class < ? > [ ] ) null ) ; } catch ( final NoSuchMethodException ex ) { return false ; } return true ; }
Check if the passed class is public instancable and has a no - argument constructor .