File tree 1 file changed +5
-3
lines changed
src/main/java/com/google/api/generator/engine/escaper 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 18
18
import com .google .common .escape .Escapers ;
19
19
20
20
public class MetacharEscaper extends Escaper {
21
+ private static final MetacharEscaper SINGLETON = new MetacharEscaper ();
22
+
21
23
// Handle escape characters (https://docs.oracle.com/javase/tutorial/java/data/characters.html)
22
24
// for the comments here, else JavaFormmater cannot properly format the string comment.
23
25
// `"` and `'` are overlooked because the comments will not be surrounded by `"` or `'`.
24
- private static final Escaper escaper =
26
+ private static final Escaper charEscaper =
25
27
Escapers .builder ()
26
28
.addEscape ('\t' , "\\ t" )
27
29
.addEscape ('\b' , "\\ b" )
@@ -35,10 +37,10 @@ private MetacharEscaper() {}
35
37
36
38
@ Override
37
39
public String escape (String sourceString ) {
38
- return escaper .escape (sourceString );
40
+ return charEscaper .escape (sourceString );
39
41
}
40
42
41
43
public static String escaper (String source ) {
42
- return new MetacharEscaper () .escape (source );
44
+ return SINGLETON .escape (source );
43
45
}
44
46
}
You can’t perform that action at this time.
0 commit comments