FileDocCategorySizeDatePackage
StringStringSource.javaAPI DocGlassfish v2 API3245Fri May 04 22:31:06 BST 2007com.sun.appserv.management.util.misc

StringStringSource

public class StringStringSource extends StringSourceBase
A StringSource which obtains its strings from a String mimicking a Properties file key1=value1 key2=value2 .... keyN=valueN etc

Fields Summary
final Properties
mPairs
Constructors Summary
public StringStringSource(String strings, StringSource delegate)

		super( delegate );
		mPairs	= new Properties();
		init( mPairs, strings );
	
Methods Summary
public java.lang.StringgetString(java.lang.String id)

		String	result	= mPairs.getProperty( id );
		
		if ( result == null )
		{
			result	= super.getString( id );
		}
		return( result );
	
private voidinit(java.util.Properties props, java.lang.String strings)

		// FIX: need to unescape the strings
		final String[]	lines	= strings.split( "\n" );
		
		for( int i = 0; i < lines.length; ++i )
		{
			final String	line	= lines[ i ];
			final int		delim	= line.indexOf( '=" );
			
			final String	name	= line.substring( 0, delim );
			final String	value	= line.substring( delim + 1, line.length() );
			
			mPairs.setProperty( name, value );
		}