public static BeanBox getUniqueBeanBox ( BeanBoxContext ctx , Class < ? > clazz ) { BeanBoxException . assureNotNull ( clazz , "Target class can not be null" ) ; BeanBox box = ctx . beanBoxMetaCache . get ( clazz ) ; if ( box != null ) return box ; if ( BeanBox . class . isAssignableFrom ( clazz ) ) try { box = ( BeanBox ) clazz . newInstance ( ) ; if ( box . singleton == null ) box . singleton = true ; } catch ( Exception e ) { BeanBoxException . throwEX ( e ) ; } else box = doCreateBeanBox ( ctx , clazz ) ; ctx . beanBoxMetaCache . put ( clazz , box ) ; return box ; }
Translate a BeanBox class or normal class to a readOnly BeanBox instance