com.atlassian.streams.api.common.Option.map()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(149)

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

Option.map介绍

暂无

代码示例

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

@Override
public Option<Html> renderContentAsHtml(StreamsEntry entry)
{
  return some(attachments).map(attachmentsRenderer);
}

代码示例来源:origin: com.atlassian.streams/streams-fisheye-plugin

public Option<Html> apply(Iterable<SummaryItem> items)
  {
    return compoundRenderer.apply(items).flatMap(trimHtmlToNone()).map(htmlToString()).map(capitalizeFirstLetter);
  }
}

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

public CommentRenderer(final TemplateRenderer templateRenderer,
    final Function<StreamsEntry, Html> titleRenderer,
    final Option<String> wikiComment,
    final Option<Html> htmlComment,
    Option<URI> styleLink)
{
  this.templateRenderer = checkNotNull(templateRenderer, "templateRenderer");
  this.titleRenderer = checkNotNull(titleRenderer, "titleRenderer");
  this.commentRenderer = htmlComment.map(renderHtml).getOrElse(renderWiki(wikiComment));
  this.styleLink = checkNotNull(styleLink, "styleLink");
}

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

public static Option<Html> summaryAsHtml(ActivityObject o)
  {
    return o.getSummary().map(summary -> new Html(escapeHtml4(summary)));
  }
}

代码示例来源:origin: com.atlassian.streams/streams-common

public Option<Html> apply(final ActivityObject o)
{
  return titleAsHtml(o).map(renderHtml(o));
}

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

public Option<Html> apply(final ActivityObject o)
{
  return o.getTitle().map(render(o));
}

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

@Override
public Option<Html> apply(final ActivityObject o)
{
  return titleAsHtml(o).map(renderHtml(o));
}

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

@Override
  public ThumbnailItem apply(@Nullable Attachment attachment) {
    return option(thumbnailManager.getThumbnail(attachment)).
        map(mkThumbnailItem(attachment, baseUri)).
        getOrElse(brokenThumbnailItem(attachment, baseUri));
  }
};

代码示例来源:origin: com.atlassian.streams/streams-confluence-plugin

private boolean shouldIncludeItem(ActivityItem item)
{
  Option<String> author = option(item.getChangedBy());
  return any(getActivities(item), inActivities)
      && item.getSpaceKey().map(forPredicate(inProjectKeys)).getOrElse(!hasSpaceFilter)
      && anyUsers.apply(author)
      && notInUsers.apply(author)
      && followedUsers.apply(item.getChangedBy())
      && inDateRange.apply(item.getModified());
}

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

public Option<Html> apply(JiraActivityItem activityItem)
  {
    return activityItem.getComment().map(commentRenderer).flatMap(trimHtmlToNone());
  }
};

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

public Html apply(StreamsEntry entry)
{
  Option<Html> objectHtml = activityObjectRenderer.flatMap(render(entry.getActivityObjects()));
  Option<Html> targetHtml = targetRenderer.flatMap(render(entry.getTarget()));
  return new Html(getText(
      key,
      concat(
        ImmutableList.of(authorsRenderer.apply(entry.getAuthors())),
        objectHtml.map(singletonList(Html.class)).getOrElse(ImmutableList.<Html>of()),
        targetHtml.map(singletonList(Html.class)).getOrElse(ImmutableList.<Html>of()))));
}

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

public Html apply(Iterable<Attachment> attachments)
{
  Pair<? extends Iterable<Attachment>, ? extends Iterable<Attachment>> init = pair(ImmutableList.<Attachment>of(), ImmutableList.<Attachment>of());
  Pair<? extends Iterable<Attachment>, ? extends Iterable<Attachment>> items = Fold.foldl(attachments, init, splitAttachments());
  return new Html(render(templateRenderer, "attachment-list.vm", ImmutableMap.of(
      "comment", withComment ? item.getComment().map(helper.renderComment()).flatMap(trimHtmlToNone()) : none(),
      "attachments", ImmutableList.copyOf(transform(items.first(), asAttachmentItem(baseUri))),
      "thumbnails", ImmutableList.copyOf(transform(items.second(), asThumbnailItem(baseUri))))));
}

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

public Option<Attachment> apply(GenericValue v)
  {
    return option(v.getString("newvalue")).map(parseLong()).flatMap(lookupAttachment);
  }
};

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

public Option<RemoteIssueLink> apply(GenericValue v)
  {
    return option(v.getString("newvalue")).map(parseLong()).flatMap(lookupRemoteIssueLink);
  }
};

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

@Override
public Option<Html> renderContentAsHtml(final StreamsEntry entry)
{
  return some(new Html(render(templateRenderer, "updated-field-list.vm", ImmutableMap.of(
      "comment", item.getComment().map(commentRenderer).flatMap(trimHtmlToNone()),
      "fieldChanges", transform(fieldChanges, renderFieldChanges()),
      "attachments", attachments,
      "attachmentsRenderer", attachmentsRenderer))));
}

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

@Override
public Html renderTitleAsHtml(StreamsEntry entry)
{
  return getResolution(item()).map(transitionWithResolution(entry)).getOrElse(transitionWithoutResolution(entry));
}

代码示例来源:origin: com.atlassian.streams/streams-confluence-plugin

@Override
public Html renderTitleAsHtml(StreamsEntry entry)
{
  return entry.getTarget().flatMap(targetRenderer).map(renderAttachedTo(entry)).getOrElse(renderAttached(entry));
}

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

@Override
public Option<Html> renderContentAsHtml(StreamsEntry entry)
{
  return some(new Html(render(templateRenderer, "jira-remote-issue-comment-block.vm", ImmutableMap.of(
      "comment", item.getComment().map(helper.renderComment()).flatMap(trimHtmlToNone())))));
}

代码示例来源:origin: com.atlassian.streams/streams-confluence-plugin

private Supplier<Option<Html>> contentAsHtml(final ContentEntityObject entity, final BodyContent bodyContent)
{
  return () -> content(entity, pageManager.getPreviousVersion(entity), bodyContent)
      .map(compose(html(), unescapeLineBreaks())).flatMap(trimHtmlToNone());
}

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

public Option<Pair<Comment, Html>> get()
  {
    if (!item.getComment().isDefined())
    {
      return none();
    }
    return some(pair(item.getComment().get(), item.getComment().map(commentRenderer).get()));
  }
});

相关文章