1 23 24 29 30 package com.sun.appserv.management.util.misc; 31 32 35 public class StringSourceBase implements StringSource 36 { 37 private final StringSource mNext; 38 39 private final static class EmptyStringSource implements StringSource 40 { 41 public final static EmptyStringSource INSTANCE = new EmptyStringSource(); 42 public EmptyStringSource() {} 43 public String getString( String id ) { return( id ); } 44 public String getString( String id, String defaultValue ) { return( defaultValue ); } 45 } 46 47 public 48 StringSourceBase() 49 { 50 this( EmptyStringSource.INSTANCE ); 51 } 52 53 public 54 StringSourceBase( StringSource next ) 55 { 56 mNext = next == null ? EmptyStringSource.INSTANCE : next; 57 } 58 59 public String 60 getString( String id ) 61 { 62 return( getString( id, id ) ); 63 } 64 65 public String 66 getString( String id, String defaultValue ) 67 { 68 return( mNext.getString( id, defaultValue ) ); 69 } 70 }; 71 72 73 74 | Popular Tags |