@ Override public Object invoke ( Object [ ] vals ) throws InvocationTargetException { try { return constr . newInstance ( vals ) ; } catch ( InvocationTargetException | IllegalArgumentException e ) { throw e ; } catch ( IllegalAccessException e ) { // runtime exception, isValid should prevent this case throw new RuntimeException ( "can't access constructor" ) ; } catch ( InstantiationException e ) { // runtime excpetion, because the constructor of constructor // has to prevent this situation. throw new RuntimeException ( "can't instantiate" ) ; } }
Invokes the Java constructor .