public static void validate ( final String string , final List < String > params ) { final List < String > vars = findVars ( string ) ; for ( String param : params ) { Preconditions . checkState ( vars . contains ( param ) , "Variable '%s' not found in target string '%s'" , param , string ) ; } vars . removeAll ( params ) ; Preconditions . checkState ( vars . isEmpty ( ) , "No parameter binding defined for variables '%s' from string '%s'" , Joiner . on ( ' ' ) . join ( vars ) , string ) ; }
Validate string variables and declared values for correctness .