本文整理汇总了Java中com.google.common.base.Receiver类的典型用法代码示例。如果您正苦于以下问题:Java Receiver类的具体用法?Java Receiver怎么用?Java Receiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Receiver类属于com.google.common.base包,在下文中一共展示了Receiver类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toLazyCompactString
import com.google.common.base.Receiver; //导入依赖的package包/类
/**
* 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.
*/
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();
}
};
}
示例2: toLazyCompactString
import com.google.common.base.Receiver; //导入依赖的package包/类
/** See spec in implementation notes. */
public static Object toLazyCompactString(final ObjectIdP objectId) {
return LazyString.toLazyCompactString(objectId, new Receiver<TextBuilder>() {
@Override
public void accept(TextBuilder builder) {
toCompactString(builder, objectId);
}
});
}
示例3: toLazyCompactStringForObjectIds
import com.google.common.base.Receiver; //导入依赖的package包/类
/** See spec in implementation notes. */
public static Object toLazyCompactStringForObjectIds(
final Collection<ObjectIdP> objectIds) {
return LazyString.toLazyCompactString(objectIds, new Receiver<TextBuilder>() {
@Override
public void accept(TextBuilder builder) {
toCompactStringForObjectIds(builder, objectIds);
}
});
}
示例4: toLazyCompactStringForInvalidations
import com.google.common.base.Receiver; //导入依赖的package包/类
/** See spec in implementation notes. */
public static Object toLazyCompactStringForInvalidations(
final Collection<InvalidationP> invalidations) {
return LazyString.toLazyCompactString(invalidations, new Receiver<TextBuilder>() {
@Override
public void accept(TextBuilder builder) {
toCompactStringForInvalidations(builder, invalidations);
}
});
}
示例5: toLazyCompactStringForRegistrations
import com.google.common.base.Receiver; //导入依赖的package包/类
/** See spec in implementation notes. */
public static Object toLazyCompactStringForRegistrations(
final Collection<RegistrationP> registrations) {
return LazyString.toLazyCompactString(registrations, new Receiver<TextBuilder>() {
@Override
public void accept(TextBuilder builder) {
toCompactStringForRegistrations(builder, registrations);
}
});
}