1 23 24 29 package com.sun.appserv.management.util.misc; 30 31 import java.util.Properties ; 32 33 34 43 public class StringStringSource extends StringSourceBase 44 { 45 final Properties mPairs; 46 47 public 48 StringStringSource( String strings, StringSource delegate ) 49 { 50 super( delegate ); 51 mPairs = new Properties (); 52 init( mPairs, strings ); 53 } 54 55 private void 56 init( Properties props, String strings ) 57 { 58 final String [] lines = strings.split( "\n" ); 60 61 for( int i = 0; i < lines.length; ++i ) 62 { 63 final String line = lines[ i ]; 64 final int delim = line.indexOf( '=' ); 65 66 final String name = line.substring( 0, delim ); 67 final String value = line.substring( delim + 1, line.length() ); 68 69 mPairs.setProperty( name, value ); 70 } 71 } 72 73 public String 74 getString( String id ) 75 { 76 String result = mPairs.getProperty( id ); 77 78 if ( result == null ) 79 { 80 result = super.getString( id ); 81 } 82 return( result ); 83 } 84 } 85 86 | Popular Tags |