private static Renderer createRenderer ( final String rendererName ) { if ( rendererName . endsWith ( ".vm" ) ) { // This is a velocity template, so use a VelocityLayout return new VelocityRenderer ( rendererName ) ; } try { Class < ? > managerClass = Class . forName ( rendererName ) ; Object manager = managerClass . newInstance ( ) ; if ( ! ( manager instanceof Renderer ) ) { throw new SystemException ( rendererName + " is not a Renderer" ) ; } return ( Renderer ) manager ; } catch ( ClassNotFoundException e ) { // Legal - there might not a manager implementation in a given theme return null ; } catch ( InstantiationException e ) { throw new SystemException ( "Failed to instantiate " + rendererName , e ) ; } catch ( IllegalAccessException e ) { throw new SystemException ( "Failed to access " + rendererName , e ) ; } }
Attempts to create a Renderer with the given name .