public < T extends ControlBean > T instantiate ( Class < T > beanClass , PropertyMap props , ControlBeanContext context , String id ) { String beanClassName = beanClass . getName ( ) ; String extImplBinding = _extImplBindings . getProperty ( beanClassName + "_" + id ) ; if ( extImplBinding == null ) extImplBinding = _extImplBindings . getProperty ( beanClassName ) ; if ( extImplBinding != null ) { BeanPropertyMap bpm = props == null ? new BeanPropertyMap ( beanClass ) : new BeanPropertyMap ( props ) ; PropertyKey propKey = new PropertyKey ( org . apache . beehive . controls . api . properties . BaseProperties . class , KEY_CONTROL_IMPLEMENTATION ) ; bpm . setProperty ( propKey , extImplBinding ) ; props = bpm ; } T ret = null ; try { Constructor < T > ctor = _constructors . get ( beanClass ) ; if ( ctor == null ) { ctor = beanClass . getConstructor ( ControlBeanContext . class , String . class , PropertyMap . class ) ; _constructors . put ( beanClass , ctor ) ; } ret = ctor . newInstance ( context , id , props ) ; } catch ( InvocationTargetException ite ) { Throwable t = ite . getCause ( ) ; throw new ControlException ( "ControlBean constructor exception" , t ) ; } catch ( Exception e ) { throw new ControlException ( "Exception creating ControlBean" , e ) ; } return ret ; }
Instantiates a new ControlBean of the requested class using mechanisms provided by a provider - specific JavaBeans framework .