com.atlassian.streams.api.common.Option类的使用及代码示例

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

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

Option介绍

暂无

代码示例

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

private Option<Pair<ActivityObjectType, ActivityVerb>> typeAndVerb(StreamsCrucibleActivityItem activityItem)
{
  Option<ActivityObjectType> type = type(activityItem);
  Option<ActivityVerb> verb = verb(activityItem);
  if (!type.isDefined() || !verb.isDefined())
  {
    return none();
  }
  return some(pair(type.get(), verb.get()));
}

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

public CommentRenderer(final TemplateRenderer templateRenderer,
    final Function<StreamsEntry, Html> titleRenderer,
    final Html comment,
    Option<URI> styleLink)
{
  this(templateRenderer, titleRenderer, none(String.class), some(comment), styleLink);
}

代码示例来源: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(attachments).map(attachmentsRenderer);
}

代码示例来源: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-core-plugin

public Option<Pair<String, String>> get()
  {
    if (userManager.getRemoteUsername() != null)
    {
      return some(param);
    }
    else
    {
      return none();
    }
  }
}

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

@Override
public Option<Html> renderContentAsHtml(StreamsEntry entry)
{
  if (!removed)
  {
    return some(new Html(render(templateRenderer, "jira-link-field-update.vm", ImmutableMap.of(
      "comment", getAggregatedComments(aggregatedItem),
      "issueKeyHtml", some(aggregatedItem.getActivityItem()).flatMap(issueRenderer).get(),
      "linkText", linkingText(aggregatedItem.getActivityItem()),
      "linkedIssueKeysHtml", issuesRenderer.apply(aggregatedItem.getRelatedActivityItems()
          .getOrElse(ImmutableList.<JiraActivityItem>of()))))));
  }
  return none();
}

代码示例来源: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

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

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

private Option<Html> getDescription(Issue issue)
  {
    String newValueString = changeItem.getString("newstring");
    if (!isBlank(newValueString))
    {
      return option(helper.renderIssueFieldValue(issue, DESCRIPTION, newValueString)).flatMap(trimHtmlToNone());
    }
    return none();
  }
}

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

public Option<String> getSpaceKey()
{
  if (entity instanceof SpaceContentEntityObject)
  {
    return option(((SpaceContentEntityObject) entity.getLatestVersion()).getSpaceKey());
  }
  else
  {
    return none();
  }
}

代码示例来源: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

@Override
  public UserProfile apply(final UserProfile userProfile)
  {
    if (historyMetadata.isDefined())
    {
      final HistoryMetadata data = historyMetadata.get();
      final HistoryMetadataParticipant actor = data.getActor();
      final boolean useActor = actor != null && isAnonymous;
      final Option<URI> generatorAvatar = (data.getGenerator() != null ? makeUri(data.getGenerator().getAvatarUrl()) : Option.<URI>none());
      return new UserProfile.Builder(useActor && actor.getId() != null ? actor.getId() : userProfile.getUsername())
          .fullName(useActor ? find(asList(actor.getDisplayName(), actor.getId()), notNull(), userProfile.getFullName()) : userProfile.getFullName())
          .profilePageUri(makeUri(useActor ? actor.getUrl() : null).orElse(userProfile.getProfilePageUri()))
          .profilePictureUri(generatorAvatar.orElse(makeUri(useActor ? actor.getAvatarUrl() : null)).orElse(userProfile.getProfilePictureUri()))
          .email(userProfile.getEmail())
          .build();
    }
    return userProfile;
  }
};

代码示例来源: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-spi

public PostReplyError(Type type, Throwable cause)
{
  this.type = checkNotNull(type, "type");
  this.cause = option(cause);
}

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

private void fetchMetadata(final AggregatedJiraActivityItem aggregatedItem)
{
  JiraActivityItem activityItem = aggregatedItem.getActivityItem();
  if (activityItem.getChangeHistory().isDefined())
  {
    HistoryMetadataManager.HistoryMetadataResult historyMetadata = historyMetadataManager.getHistoryMetadata(activityItem.getChangeHistory().get(), authenticationContext.getUser());
    activityItem.setHistoryMetadata(option(historyMetadata.getHistoryMetadata()));
  }
}

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

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-thirdparty-api

public Option<String> checkString(Option<String> value, String propertyName, int maxLength)
{
  if (value.isDefined())
  {
    checkString(value.get(), propertyName, maxLength);
  }
  return value;
}

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

public Builder(URI url)
{
  errors.checkAbsoluteUri(some(url), "url");
  this.url = url;
}

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

public boolean apply(AttachmentActivityItem.Entry attachment)
  {
    return attachment.getPreview().isDefined();
  }
};

相关文章