@Override
	public String substituteProps(String str, SubstitutionTransformer transformer) {
		if (str == null) {
			return null;
		}
		StringBuffer buf = new StringBuffer();
		Matcher matcher = pattern.matcher(str);
		while ( matcher.find() ) {
			String propName = matcher.group(1);
			String propValue = getPropValue(propName);
			if (propValue != null) {
				if (transformer != null) {
					propValue = transformer.transform(propName, propValue);
				}
				matcher.appendReplacement(
						buf,
						propValue
						.replace("\\", "\\\\") //$NON-NLS-1$ //$NON-NLS-2$
						.replace("$", "\\$")  //$NON-NLS-1$ //$NON-NLS-2$
						);
			} else {
				matcher.appendReplacement(buf, "\\${"+propName+"}"); //$NON-NLS-1$ //$NON-NLS-2$
			}
		}
		matcher.appendTail(buf);
		return buf.toString();
	}
@ Override public String substituteProps ( String str , SubstitutionTransformer transformer ) { if ( str == null ) { return null ; } StringBuffer buf = new StringBuffer ( ) ; Matcher matcher = pattern . matcher ( str ) ; while ( matcher . find ( ) ) { String propName = matcher . group ( 1 ) ; String propValue = getPropValue ( propName ) ; if ( propValue != null ) { if ( transformer != null ) { propValue = transformer . transform ( propName , propValue ) ; } matcher . appendReplacement ( buf , propValue . replace ( "\\" , "\\\\" ) . replace ( "$" , "\\$" ) ) ; } else { matcher . appendReplacement ( buf , "\\${" + propName + "}" ) ; } } matcher . appendTail ( buf ) ; return buf . toString ( ) ; }
/* (non-Javadoc)
@see com.ibm.jaggr.core.IAggregator#substituteProps(java.lang.String, com.ibm.jaggr.core.IAggregator.SubstitutionTransformer)