public static String replace ( final Object source , final Properties valueProperties ) { if ( valueProperties == null ) { return source . toString ( ) ; } final Map < String , String > valueMap = new HashMap <> ( ) ; final Enumeration < ? > propNames = valueProperties . propertyNames ( ) ; while ( propNames . hasMoreElements ( ) ) { final String propName = ( String ) propNames . nextElement ( ) ; final String propValue = valueProperties . getProperty ( propName ) ; valueMap . put ( propName , propValue ) ; } return StrSubstitutor . replace ( source , valueMap ) ; }
Replaces all the occurrences of variables in the given source object with their matching values from the properties .