List of usage examples for com.google.common.base CharEscaper escape
protected abstract char[] escape(char c);
From source file:com.google.gxp.base.GxpClosures.java
/** * Create a {@code GxpClosure} based on a {@code String} escaped with * the given {@code CharEscaper}.//from www. j av a 2 s . c om */ public static GxpClosure fromString(final String value, final CharEscaper escaper) { Preconditions.checkNotNull(value); Preconditions.checkNotNull(escaper); return new GxpClosure() { public void write(Appendable out, GxpContext gxpContext) throws IOException { escaper.escape(out).append(value); } }; }
From source file:com.google.gxp.base.GxpClosures.java
/** * Create a {@code GxpClosure} based on a {@code Localizable} escaped with * the given {@code CharEscaper}./*from w w w . j av a2 s. c o m*/ */ public static GxpClosure fromLocalizable(final Localizable value, final CharEscaper escaper) { Preconditions.checkNotNull(value); Preconditions.checkNotNull(escaper); return new GxpClosure() { public void write(Appendable out, GxpContext gxpContext) throws IOException { escaper.escape(out).append(value.toString(gxpContext.getLocale())); } }; }