List of usage examples for com.google.common.base Receiver accept
void accept(T object);
From source file:com.google.ipc.invalidation.util.LazyString.java
/** * Given an {@code element} to be logged lazily, returns null if the object is null. Otherwise, * return an object that would convert it to a string using {@code builderFunction}. I.e., this * method will call {@code builderFunction} with a new {@link TextBuilder} return the string * created with it.//w w w . j av a 2s .co m */ public static <T> Object toLazyCompactString(final T element, final Receiver<TextBuilder> builderFunction) { if (element == null) { return null; } return new Object() { @Override public String toString() { TextBuilder builder = new TextBuilder(); builderFunction.accept(builder); return builder.toString(); } }; }