Returns a UnicodeEscaper equivalent to the given escaper instance. If the escaper is already a UnicodeEscaper then it is simply returned, otherwise it is wrapped in a UnicodeEscaper. When a CharEscaper escaper is wrapped by this method it acquires extra behavior with respect to t
(Escaper escaper)
| 193 | |
| 194 | |
| 195 | static UnicodeEscaper asUnicodeEscaper(Escaper escaper) { |
| 196 | checkNotNull(escaper); |
| 197 | if (escaper instanceof UnicodeEscaper) { |
| 198 | return (UnicodeEscaper) escaper; |
| 199 | } else if (escaper instanceof CharEscaper) { |
| 200 | return wrap((CharEscaper) escaper); |
| 201 | } |
| 202 | // In practice this shouldn't happen because it would be very odd not to |
| 203 | // extend either CharEscaper or UnicodeEscaper for non trivial cases. |
| 204 | throw new IllegalArgumentException("Cannot create a UnicodeEscaper from: " + escaper.getClass().getName()); |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Returns a string that would replace the given character in the specified escaper, or |
nothing calls this directly
no test coverage detected