ch.lambdaj.Lambda.of()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(388)

本文整理了Java中ch.lambdaj.Lambda.of()方法的一些代码示例,展示了Lambda.of()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lambda.of()方法的具体详情如下:
包路径:ch.lambdaj.Lambda
类名称:Lambda
方法名:of

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

  1. /**
  2. * Binds an object to the active closure that is the last one created in the current thread.
  3. * @param closed The object that has to be bound to the active closure
  4. * @return A proxy of the same class of the passed object used to register all the invocation on the closed object
  5. */
  6. public static <T> T of(T closed) {
  7. return of(closed, (Class<T>)closed.getClass());
  8. }

代码示例来源:origin: ru.yandex.qatools.camelot.utils/plugin-utils

  1. @SuppressWarnings("unchecked")
  2. public static <T> List<T> getPluginStatesList(AggregatorRepository<T> repo, boolean localKeysOnly) {
  3. Closure closure = closure(); of(repo).get(Lambda.var(String.class));
  4. return (List<T>) closure.each((localKeysOnly ? repo.localKeys() : repo.keys()));
  5. }
  6. }

代码示例来源:origin: jtalks-org/jcommune

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void createPoll(Poll poll) {
  6. this.getDao().saveOrUpdate(poll);
  7. Closure1<PollItem> closure = closure(PollItem.class);
  8. of(pollOptionDao).saveOrUpdate(var(PollItem.class));
  9. closure.each(poll.getPollItems());
  10. securityService.createAclBuilder().grant(GeneralPermission.WRITE)
  11. .to(groupDao.getGroupByName(AdministrationGroup.USER.getName()))
  12. .on(poll).flush();
  13. }

相关文章