import { StatedBeanContainer } from './StatedBeanContainer' ; export interface InitializingBean { afterProvided ( ) : void ; } export interface DisposableBean { destroy ( ) : void ; } export interface BeanContainerAware { setBeanContainer ( beanContainer ) : void ; } export function getProperty < T , K extends keyof T > ( obj , key ) { if ( key in obj ) { return obj [ key as K ] ; } return undefined ; } export function isInitializingBean ( bean ) { const property = getProperty ( bean , 'afterProvided' ) ; return property !== undefined && typeof property === 'function' ; } export function isDisposableBean ( bean ) { const property = getProperty ( bean , 'destroy' ) ; return property !== undefined && typeof property === 'function' ; } export function isBeanContainerAware ( bean ) { const property = getProperty ( bean , 'setBeanContainer' ) ; return property !== undefined && typeof property === 'function' ; }