protected void copyOutAttributes ( Object target , List < Attribute > jmxAttributeValues , Map < String , Method > attributeSetters , String identifierKey , Object identifier ) { for ( Attribute oneAttribute : jmxAttributeValues ) { String attributeName = oneAttribute . getName ( ) ; Method setter = attributeSetters . get ( attributeName ) ; Object value = oneAttribute . getValue ( ) ; try { // // Automatically down-convert longs to integers as-needed. // if ( ( setter . getParameterTypes ( ) [ 0 ] . isAssignableFrom ( Integer . class ) ) || ( setter . getParameterTypes ( ) [ 0 ] . isAssignableFrom ( int . class ) ) ) { if ( value instanceof Long ) { value = ( ( Long ) value ) . intValue ( ) ; } } setter . invoke ( target , value ) ; } catch ( InvocationTargetException invocationExc ) { this . log . info ( "invocation exception storing mbean results: {}={}; attributeName={}" , identifierKey , identifier , attributeName , invocationExc ) ; } catch ( IllegalAccessException illegalAccessExc ) { this . log . info ( "illegal access exception storing mbean results: {}={}; attributeName={}" , identifierKey , identifier , attributeName , illegalAccessExc ) ; } catch ( IllegalArgumentException illegalArgumentExc ) { this . log . info ( "illegal argument exception storing mbean results: {}={}; attributeName={}" , identifierKey , identifier , attributeName , illegalArgumentExc ) ; } } }
Copy the values of the given attributes into the target object using the specified setter methods mapped by attribute name .