public static String replace(final Object source,final Properties valueProperties){
  if (valueProperties == null) {
    return source.toString();
  }
  final Map<String,String> valueMap=new HashMap<String,String>();
  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);
}

public static String replace ( final Object source , final Properties valueProperties ) { if ( valueProperties == null ) { return source . toString ( ) ; } final Map < String , String > valueMap = new HashMap < String , String > ( ) ; 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 .
