@Test public void escapeWithBackslash() throws Exception { NamePatternEscaping escaping = new NamePatternEscaping("\\"); assertNull(escaping.escape(null)); assertEquals("TABLE", escaping.escape("TABLE")); assertEquals("\\\\TABLE", escaping.escape("\\TABLE")); assertEquals("/TABLE", escaping.escape("/TABLE")); assertEquals("TABLE\\_NAME", escaping.escape("TABLE_NAME")); assertEquals("\\\\TABLE\\_\\%NAME", escaping.escape("\\TABLE_%NAME")); assertEquals("/TABLE\\_\\%NAME", escaping.escape("/TABLE_%NAME")); }
public String escape(String name) { if (needsEscaping(name)) { return replacementPattern.matcher(name).replaceAll(replacement); } else { return name; } }
NamePatternEscaping { public String escape(String name) { if (needsEscaping(name)) { return replacementPattern.matcher(name).replaceAll(replacement); } else { return name; } } }
NamePatternEscaping { public String escape(String name) { if (needsEscaping(name)) { return replacementPattern.matcher(name).replaceAll(replacement); } else { return name; } } NamePatternEscaping(String escape); }
NamePatternEscaping { public String escape(String name) { if (needsEscaping(name)) { return replacementPattern.matcher(name).replaceAll(replacement); } else { return name; } } NamePatternEscaping(String escape); String escape(String name); }
NamePatternEscaping { public String escape(String name) { if (needsEscaping(name)) { return replacementPattern.matcher(name).replaceAll(replacement); } else { return name; } } NamePatternEscaping(String escape); String escape(String name);  }