public void update ( StatusData < T > status ) { if ( status == null ) { throw new IllegalArgumentException ( "Received null as status data!" ) ; } neverUpdated = false ; handleStatsResetIfNeeded ( status ) ; for ( T metric : metrics ) { Object value = status . get ( metric ) ; if ( value == null ) { getLogger ( ) . warn ( "StatusData contains no value for metric '" + metric . getCaption ( ) + "'." ) ; continue ; } StatValue stat = getMonitoredStatValue ( metric ) ; switch ( metric . getType ( ) ) { case INT : stat . setValueAsInt ( Integer . class . cast ( value ) ) ; break ; case DOUBLE : stat . setValueAsDouble ( Double . class . cast ( value ) ) ; break ; case STRING : stat . setValueAsString ( value . toString ( ) ) ; break ; case COUNTER : case DIFFLONG : case LONG : stat . setValueAsLong ( Long . class . cast ( value ) ) ; break ; default : stat . setValueAsString ( value . toString ( ) ) ; break ; } } }
Update this stats with new data contained in StatusData parameter .