本文整理了Java中ch.lambdaj.Lambda.of()
方法的一些代码示例,展示了Lambda.of()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.of()
方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:of
[英]Binds a free variable of the given class to the active closure that is the last one created in the current thread.
[中]将给定类的自由变量绑定到当前线程中创建的最后一个活动闭包。
代码示例来源:origin: mariofusco/lambdaj
/**
* Binds an object to the active closure that is the last one created in the current thread.
* @param closed The object that has to be bound to the active closure
* @return A proxy of the same class of the passed object used to register all the invocation on the closed object
*/
public static <T> T of(T closed) {
return of(closed, (Class<T>)closed.getClass());
}
代码示例来源:origin: ru.yandex.qatools.camelot.utils/plugin-utils
@SuppressWarnings("unchecked")
public static <T> List<T> getPluginStatesList(AggregatorRepository<T> repo, boolean localKeysOnly) {
Closure closure = closure(); of(repo).get(Lambda.var(String.class));
return (List<T>) closure.each((localKeysOnly ? repo.localKeys() : repo.keys()));
}
}
代码示例来源:origin: jtalks-org/jcommune
/**
* {@inheritDoc}
*/
@Override
public void createPoll(Poll poll) {
this.getDao().saveOrUpdate(poll);
Closure1<PollItem> closure = closure(PollItem.class);
of(pollOptionDao).saveOrUpdate(var(PollItem.class));
closure.each(poll.getPollItems());
securityService.createAclBuilder().grant(GeneralPermission.WRITE)
.to(groupDao.getGroupByName(AdministrationGroup.USER.getName()))
.on(poll).flush();
}
内容来源于网络,如有侵权,请联系作者删除!