String (@NotNull String value, @NotNull String encoding) { if (encoding.equalsIgnoreCase("url")) { return urlEscaper.escape(value); } else if (encoding.equalsIgnoreCase("none")) { return value; } else if (encoding.equalsIgnoreCase("entity")) { return HtmlEscapers.htmlEscaper().escape(value); } else { throw new IllegalArgumentException("Unknown encoding: " + encoding); } }