FileDocCategorySizeDatePackage
TabularDataStringifier.javaAPI DocGlassfish v2 API3365Fri May 04 22:31:06 BST 2007com.sun.appserv.management.util.jmx.stringifier

TabularDataStringifier

public class TabularDataStringifier extends Object implements com.sun.appserv.management.util.stringifier.Stringifier

Fields Summary
public static final TabularDataStringifier
DEFAULT
Constructors Summary
public TabularDataStringifier()

	
		
	 
	
	
Methods Summary
public java.lang.Stringstringify(java.lang.Object o)

		final StringBuffer	buf	= new StringBuffer();
		buf.append( "Tabular data:\n" );
		
		final TabularData	data	= (TabularData)o;
		final TabularType	type	= data.getTabularType();
		
		final List		indexNames	= type.getIndexNames();
		final Set		rowKeys		= data.keySet();
		final Iterator	rowIter	= rowKeys.iterator();
		int				rowIndex	= 0;
		while ( rowIter.hasNext() )
		{
			final Object[]		key		= (Object[])rowIter.next();
			final CompositeData	item	= data.get( key );
			
			final String	s	= SmartStringifier.toString( item );
			
			// emit the row index followed by the row
			buf.append( "[" + rowIndex + "] " );
			buf.append( s + "\n" );
			
			++rowIndex;
		}
		
		return( buf.toString() );