/** * Replace variables in a string <br/> * Actually calls * <code>replace ( string, replcaeSource, pattern, true )</code>. */ public static String replace ( final String string, final ReplaceSource replaceSource, final Pattern pattern ) { return replace ( string, replaceSource, pattern, true ); } }
/** * Replace with the default pattern of <code>${var}</code> * * @param string * the string which should be processed, may be <code>null</code> * @param properties * the properties used for replacing * @return the source string with patterns replaced */ public static String replace ( final String string, final Map<?, ?> properties ) { return replace ( string, newSource ( properties ), DEFAULT_PATTERN ); }
protected String expand ( final String string, final Map<String, String> properties ) { return StringReplacer.replace ( string, new ExtendedPropertiesReplacer ( properties, true ), StringReplacer.DEFAULT_PATTERN ); }
private static String replace(final String string) { return StringReplacer.replace(string, StringReplacer.newExtendedSource(System.getenv()), StringReplacer.DEFAULT_PATTERN); }
private static String replace(final String string) { return StringReplacer.replace(string, StringReplacer.newExtendedSource(System.getenv()), StringReplacer.DEFAULT_PATTERN); }
public static ContentProvider createContent ( final InputStream resource, final Map<String, String> replacements, final Pattern pattern ) throws IOException { try { String str = CharStreams.toString ( new InputStreamReader ( resource, StandardCharsets.UTF_8 ) ); str = StringReplacer.replace ( str, StringReplacer.newSource ( replacements ), pattern ); return new StaticContentProvider ( str ); } finally { resource.close (); } }
protected static void createFile ( final File file, final InputStream resource, final Map<String, String> replacements, final IProgressMonitor monitor, final Pattern pattern ) throws Exception { try { String str = CharStreams.toString ( new InputStreamReader ( resource, StandardCharsets.UTF_8 ) ); str = StringReplacer.replace ( str, StringReplacer.newSource ( replacements ), pattern ); createFile ( file, str, monitor ); } finally { resource.close (); } }
private String makePath ( final Map<String, String> vars, final DSFileBackend s ) { return StringReplacer.replace ( s.getPath (), StringReplacer.newExtendedSource ( vars ), VAR_PATTERN, true ); }
private String makePath ( final Map<String, String> vars, final ConfigurationAdminFileBackend s ) { return StringReplacer.replace ( s.getPath (), StringReplacer.newExtendedSource ( vars ), VAR_PATTERN, true ); }
public static ContentProvider createContent ( final InputStream resource, final Map<String, String> replacements, final Pattern pattern ) throws IOException { try { String str = CharStreams.toString ( CharStreams.newReaderSupplier ( new InputSupplier<InputStream> () { @Override public InputStream getInput () throws IOException { return resource; } }, Charset.forName ( "UTF-8" ) ) ); //$NON-NLS-1$ str = StringReplacer.replace ( str, StringReplacer.newSource ( replacements ), pattern ); return new StaticContentProvider ( str ); } finally { resource.close (); } }
return replace ( resultString, replaceSource, pattern, true );
protected static void createFile ( final File file, final InputStream resource, final Map<String, String> replacements, final IProgressMonitor monitor, final Pattern pattern ) throws Exception { try { String str = CharStreams.toString ( CharStreams.newReaderSupplier ( new InputSupplier<InputStream> () { @Override public InputStream getInput () throws IOException { return resource; } }, Charset.forName ( "UTF-8" ) ) ); str = StringReplacer.replace ( str, StringReplacer.newSource ( replacements ), pattern ); createFile ( file, str, monitor ); } finally { resource.close (); } }