static String substitute ( String pattern , Map < String , String > vars ) { String value = pattern ; for ( Map . Entry < String , String > entry : vars . entrySet ( ) ) { String raw = entry . getValue ( ) ; String v = Introspector . decapitalize ( raw ) ; value = value . replace ( "{raw:" + entry . getKey ( ) + "}" , raw ) ; value = value . replace ( "{" + entry . getKey ( ) + "}" , v ) ; } return value ; }
Substitute named variables in the pattern string with the corresponding values in the variables map .