@ Override public DynamicMBean getMBeanFor ( Object object ) throws IllegalStateException { JmxBean jmxBean = AnnotationUtils . getAnnotation ( object . getClass ( ) , JmxBean . class ) ; if ( jmxBean == null ) { throw new IllegalArgumentException ( "Could not find annotation " + JmxBean . class + " on " + object . getClass ( ) ) ; } try { ClassIntrospector classIntrospector = new ClassIntrospectorImpl ( object . getClass ( ) ) ; DynamicMBeanImpl mbean = new DynamicMBeanImpl ( object ) ; mbean . setmBeanInfo ( getInfo ( object , classIntrospector ) ) ; Map < String , Method > getters = new HashMap < String , Method > ( ) ; Map < String , Method > setters = new HashMap < String , Method > ( ) ; resolveGettersAndSetters ( classIntrospector , getters , setters ) ; mbean . setGetters ( getters ) ; mbean . setSetters ( setters ) ; mbean . setOperations ( getOperationsMap ( classIntrospector ) ) ; return mbean ; } catch ( Exception e ) { throw new IllegalStateException ( "Could not create DynamicMBean for " + object , e ) ; } }
Returns a DynamicMBean generated for the supplied object