public Object getAttribute(String attribute) throws AttributeNotFoundException,
            MBeanException, ReflectionException {
        PropertyDescriptor propertyDescriptor = propertyDescriptors.get(attribute);
        if (propertyDescriptor == null) {
            throw new AttributeNotFoundException(attribute);
        }
        Method getter = propertyDescriptor.getReadMethod();
        if (getter == null) {
            throw new AttributeNotFoundException(
                    format("Getter method for attribute %s of %s", attribute, mbeanClass));
        }
        try {
            if (!getter.isAccessible()) {
                getter.setAccessible(true);
            }
            return getter.invoke(mbean);
        } catch (InvocationTargetException e) {
            throw new MBeanException((Exception) e.getCause());
        } catch (Exception e) {
            throw new RuntimeException(
                    format("Unable to obtain value of attribute %s of %s", attribute, mbeanClass));
        }
    }
public Object getAttribute ( String attribute ) throws AttributeNotFoundException , MBeanException , ReflectionException { PropertyDescriptor propertyDescriptor = propertyDescriptors . get ( attribute ) ; if ( propertyDescriptor == null ) { throw new AttributeNotFoundException ( attribute ) ; } Method getter = propertyDescriptor . getReadMethod ( ) ; if ( getter == null ) { throw new AttributeNotFoundException ( format ( "Getter method for attribute %s of %s" , attribute , mbeanClass ) ) ; } try { if ( ! getter . isAccessible ( ) ) { getter . setAccessible ( true ) ; } return getter . invoke ( mbean ) ; } catch ( InvocationTargetException e ) { throw new MBeanException ( ( Exception ) e . getCause ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( format ( "Unable to obtain value of attribute %s of %s" , attribute , mbeanClass ) ) ; } }
@Override commented out for JDK 5 compatibility