String getFormattedCompositeData ( CompositeData cd , String indent ) { StringBuilder sb = new StringBuilder ( ) ; indent += INDENT ; CompositeType type = cd . getCompositeType ( ) ; for ( String key : type . keySet ( ) ) { sb . append ( "\n" ) . append ( indent ) ; sb . append ( key ) . append ( ": " ) ; OpenType < ? > openType = type . getType ( key ) ; if ( openType instanceof SimpleType ) { sb . append ( cd . get ( key ) ) ; } else if ( openType instanceof CompositeType ) { CompositeData nestedData = ( CompositeData ) cd . get ( key ) ; sb . append ( getFormattedCompositeData ( nestedData , indent ) ) ; } else if ( openType instanceof TabularType ) { TabularData tabularData = ( TabularData ) cd . get ( key ) ; sb . append ( tabularData ) ; } } return String . valueOf ( sb ) ; }
Format an open MBean composite data attribute .