it.tidalwave.util.As.asMany()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(186)

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

As.asMany介绍

暂无

代码示例

代码示例来源:origin: it.tidalwave.thesefoolishthings/it-tidalwave-role

/*******************************************************************************************************************
 *
 * {@inheritDoc}
 *
 ******************************************************************************************************************/
@Override @Nonnull
public <T> Collection<T> asMany (final @Nonnull Class<T> roleType)
 {
  final Collection<T> result = asSupport.asMany(roleType);
  // The problem here is that we want only to add local roles in owner; but calling owner.as() will also
  // find again the global roles that were discovered by AsSupport.
  if (roleType.isAssignableFrom(owner.getClass()))
   {
    result.add(roleType.cast(owner));
   }
  if (owner instanceof As)
   {
    result.addAll(((As)owner).asMany(roleType));
   }
  return result;
 }

代码示例来源:origin: it.tidalwave.northernwind.rca/it-tidalwave-role-ui-javafx

asObjectWithUserActionProvider = mock(As.class);
when(asObjectWithoutUserActionProvider.as(eq(UserActionProvider.class))).thenThrow(new AsException(UserActionProvider.class));
when(asObjectWithoutUserActionProvider.asMany(eq(UserActionProvider.class))).thenReturn(new ArrayList<UserActionProvider>());
when(asObjectWithUserActionProvider.as(eq(UserActionProvider.class))).thenReturn(userActionProvider);
when(asObjectWithUserActionProvider.asMany(eq(UserActionProvider.class))).thenReturn(Arrays.asList(userActionProvider));

相关文章