1 /* HEADER */ 2 package com.sslexplorer.boot; 3 4 import java.util.regex.Matcher; 5 import java.util.regex.Pattern; 6 7 /** 8 * When replacement patterns are registered with a 9 * {@link com.sslexplorer.boot.ReplacementEngine}, an implementation of this 10 * interface must also be provided. 11 * <p> 12 * When the engine is processing some content and finds a match the 13 * {@link #getReplacement(Pattern, Matcher, String)} method will be invoked 14 * expecting the replacement value to be returned. 15 * <p> 16 * A replacement pattern <i>may</i> also has been provided which the 17 * implementation may or may not make use of. 18 * 19 * @author Brett Smith <a HREF="mailto: brett@3sp.com"><brett@3sp.com></a> 20 */ 21 public interface Replacer { 22 23 /** 24 * Get the value to replace the matched content with. 25 * 26 * @param pattern pattern that made the match 27 * @param matcher the matcher that made the match 28 * @param replacementPattern the optional replacement pattern that may have 29 * been provided when the pattern was registered with the replacement 30 * engine 31 * @return replacement value or <code>null</code> to replace nothing 32 */ 33 public String getReplacement(Pattern pattern, Matcher matcher, String replacementPattern); 34 }