public Object newInstance ( String resource ) { try { String name = resource . startsWith ( "/" ) ? resource : "/" + resource ; File file = new File ( this . getClass ( ) . getResource ( name ) . toURI ( ) ) ; return newInstance ( classLoader . parseClass ( new GroovyCodeSource ( file ) , true ) ) ; } catch ( Exception e ) { throw new GroovyClassInstantiationFailed ( classLoader , resource , e ) ; } }
Creates an object instance from the Groovy resource