public T constructObject ( String simpleName ) { if ( simpleName == null ) { return null ; } if ( this . constructors . containsKey ( simpleName ) ) { try { Class < ? extends T > clazz = this . constructors . get ( simpleName ) ; if ( clazz != null ) { return clazz . newInstance ( ) ; } return null ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } } throw new RuntimeException ( "[construction error] constructor <" + simpleName + "> not registered in " + getClass ( ) . getSimpleName ( ) ) ; }
Creates an object by instantiating the registered class associated to the given key