FileDocCategorySizeDatePackage
ArrayStringifier.javaAPI DocGlassfish v2 API4461Fri May 04 22:31:06 BST 2007com.sun.appserv.management.util.stringifier

ArrayStringifier

public final class ArrayStringifier extends Object implements Stringifier
Stringifies an array, using an optional array element Stringifier

Fields Summary
final String
mDelim
final Stringifier
mElementStringifier
boolean
mAddBraces
static final char
LEFT_BRACE
static final char
RIGHT_BRACE
static final String
DEFAULT_DELIM
public static final ArrayStringifier
DEFAULT
Constructors Summary
public ArrayStringifier()

	
		 
	
	
		this( SmartStringifier.DEFAULT );
		mAddBraces	= false;
	
public ArrayStringifier(boolean addBraces)

		this( DEFAULT_DELIM, SmartStringifier.DEFAULT, addBraces );
	
public ArrayStringifier(String delim)

		this( delim, false );
	
public ArrayStringifier(String delim, boolean addBraces)

		this( delim, SmartStringifier.DEFAULT, addBraces );
	
public ArrayStringifier(Stringifier elementStringifier)

		this( DEFAULT_DELIM, elementStringifier );
	
public ArrayStringifier(String delim, Stringifier elementStringifier)

		this( delim, elementStringifier, false );
	
public ArrayStringifier(String delim, Stringifier elementStringifier, boolean addBraces)

		mDelim				= delim;
		mElementStringifier	= elementStringifier;
		mAddBraces			= addBraces;
	
Methods Summary
static java.lang.StringaddBraces(boolean add, java.lang.String s)

		String	out	= s;
		if ( add )
		{
			out	= LEFT_BRACE + s + RIGHT_BRACE;
		}
		return( out );
	
public static java.lang.Stringstringify(java.lang.Object[] o, java.lang.String delim, Stringifier stringifier)
Static variant when direct call will suffice.

		final Iterator	iter		= Arrays.asList( o ).iterator();
		final IteratorStringifier	iterStringifier	= new IteratorStringifier( delim, stringifier );
		
		final String	s	= iterStringifier.stringify( iter );
		return( s );
	
public static java.lang.Stringstringify(java.lang.Object[] o, java.lang.String delim)
Static variant when direct call will suffice.

		return( stringify( o, delim, SmartStringifier.DEFAULT ) );
	
public java.lang.Stringstringify(java.lang.Object o)

		final String	s	= this.stringify( (Object [])o, mDelim, mElementStringifier );
		
		return( addBraces( mAddBraces, s ) );