public static String printCollectionAware ( final Object object , final boolean printBody ) { if ( ! printBody ) { return PRINT_HIDDEN ; } if ( object == null ) { return String . valueOf ( object ) ; } Class < ? > clazz = object . getClass ( ) ; if ( ! Collection . class . isAssignableFrom ( clazz ) ) { return String . valueOf ( object ) ; } return new StringBuilder ( ) . append ( "[<" ) . append ( clazz . getSimpleName ( ) ) . append ( "> size = " ) . append ( Collection . class . cast ( object ) . size ( ) ) . append ( "]" ) . toString ( ) ; }
Gets object representation with size for collection case .