public String format ( ) { String result = message ; for ( Object object : objects ) { String s = result . replaceFirst ( "%%" , Matcher . quoteReplacement ( stringify ( object ) ) ) ; if ( result . equals ( s ) ) { throw new IllegalStateException ( "Too many parameters" ) ; } result = s ; } if ( result . contains ( "%%" ) ) { throw new IllegalStateException ( "Not enough parameters" ) ; } return result ; }
Formats the message with the given objects .