com.atlassian.fugue.Either.map()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(86)

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

Either.map介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.jira/jira-rest-plugin

@Override
public Either<ErrorCollection, PermissionGrantInput> fromBean(final PermissionGrantBean grantBean)
{
  return validated(grantBean).map(new Function<PermissionGrantBean, PermissionGrantInput>()
  {
    @Override
    public PermissionGrantInput apply(final PermissionGrantBean grantBean)
    {
      return PermissionGrantInput.newGrant(
          holder(getActorType(grantBean).get(), grantBean.getHolder().getParameter()),
          new ProjectPermissionKey(grantBean.getPermission()));
    }
  });
}

代码示例来源:origin: com.atlassian.jira/jira-rest-plugin

@Override
public Either<ErrorCollection, Collection<PermissionGrantInput>> fromBean(final List<PermissionGrantBean> permissions)
{
  return sequenceRight(transform(firstNonNull(permissions, Collections.<PermissionGrantBean>emptyList()), new Function<PermissionGrantBean, Either<ErrorCollection, PermissionGrantInput>>()
  {
    @Override
    public Either<ErrorCollection, PermissionGrantInput> apply(final PermissionGrantBean grantBean)
    {
      return fromBean(grantBean);
    }
  })).map(new Function<Iterable<PermissionGrantInput>, Collection<PermissionGrantInput>>()
  {
    @Override
    public Collection<PermissionGrantInput> apply(final Iterable<PermissionGrantInput> grants)
    {
      return ImmutableList.copyOf(grants);
    }
  });
}

代码示例来源:origin: com.atlassian.jira/jira-rest-plugin

@Override
  public Either<ErrorCollection, PermissionSchemeInput> apply(final PermissionSchemeBean permissionScheme)
  {
    return fromBean(permissionScheme.getPermissions()).map(new Function<Collection<PermissionGrantInput>, PermissionSchemeInput>()
    {
      @Override
      public PermissionSchemeInput apply(final Collection<PermissionGrantInput> permissionGrants)
      {
        return PermissionSchemeInput.builder(permissionScheme.getName())
            .setDescription(permissionScheme.getDescription())
            .setPermissions(permissionGrants)
            .build();
      }
    });
  }
});

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
  public Either<AttachmentError, ChangeItemBean> apply(
      @SuppressWarnings ("NullableProblems") final TemporaryWebAttachment tempAttachment)
  {
    final Either<AttachmentError, ChangeItemBean> conversionResult = attachmentManager.convertTemporaryAttachment(
        ConvertTemporaryAttachmentParams.builder()
            .setAuthor(user)
            .setIssue(issue)
            .setTemporaryAttachmentId(tempAttachment.getTemporaryAttachmentId())
            .setFilename(tempAttachment.getFilename())
            .setContentType(tempAttachment.getContentType())
            .setFileSize(tempAttachment.getSize())
            .setCreatedTime(tempAttachment.getCreated())
            .build()
    );
    return conversionResult.map(new Function<ChangeItemBean, ChangeItemBean>()
    {
      @Override
      public ChangeItemBean apply(@SuppressWarnings ("NullableProblems") final ChangeItemBean changeItemBean)
      {
        monitor.removeById(selectedAttachmentId);
        return changeItemBean;
      }
    });
  }
};

相关文章

微信公众号

最新文章

更多