MCPcopy Create free account
hub / github.com/antlr/codebuff / asUnicodeEscaper

Method asUnicodeEscaper

output/java_guava/1.4.18/Escapers.java:195–205  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

wrapMethod · 0.95
checkNotNullMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected