public static AttrResultInfo getMBeanAttributeResultInfo ( String name , MBeanAttributeInfo attrInfo ) throws JMException { ClassLoader loader = SecurityActions . getThreadContextClassLoader ( ) ; MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; String attrName = attrInfo . getName ( ) ; String attrType = attrInfo . getType ( ) ; Object value = null ; Throwable throwable = null ; if ( attrInfo . isReadable ( ) ) { try { value = server . getAttribute ( objName , attrName ) ; } catch ( Throwable t ) { throwable = t ; } } Class typeClass = null ; try { typeClass = Classes . getPrimitiveTypeForName ( attrType ) ; if ( typeClass == null ) typeClass = loader . loadClass ( attrType ) ; } catch ( ClassNotFoundException cnfe ) { // Ignore } PropertyEditor editor = null ; if ( typeClass != null ) editor = PropertyEditorManager . findEditor ( typeClass ) ; return new AttrResultInfo ( attrName , editor , value , throwable ) ; }
Get MBean attribute result info