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

x33g5p2x  于2022-01-25 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(124)

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

Option.map介绍

暂无

代码示例

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

private Option<FieldData> createFieldData(final Field field, final Option<FieldJsonRepresentation> representation)
{
  return representation.map(new Function<FieldJsonRepresentation, FieldData>()
  {
    @Override
    public FieldData apply(final FieldJsonRepresentation representation)
    {
      return new FieldData(field, representation);
    }
  });
}

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

private Option<String> getAttrValue(Option<ActionInfo.ViewInfo> viewInfo, final String attrName)
{
  return viewInfo.map(new Function<ActionInfo.ViewInfo, String>()
  {
    @Override
    public String apply(final ActionInfo.ViewInfo input)
    {
      return input.getAttributeValue(attrName);
    }
  });
}

代码示例来源:origin: com.atlassian.plugins/base-hipchat-integration-plugin-api

@Override public Option<Pair<HipChatUserId, String>> findHipChatUserAndName(UserKey userKey) {
    return hipChatAOUserManager.getByUserKey(userKey).map(new Function<AOHipChatUser, Pair<HipChatUserId, String>>() {
      @Override
      public Pair<HipChatUserId, String> apply(final AOHipChatUser input) {
        return Pair.pair(new HipChatUserId(input.getHipChatUserId(), new HipChatLinkId(input.getHipChatLink().getID())), input.getHipChatUserName());
      }
    });
  }
}

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

private static String toShortLicenseString(Option<? extends LicenseDetails> details)
{
  return details.map(LicenseDetails::getLicenseString)
      .map(str -> StringUtils.abbreviate(str, 100))
      .getOrNull();
}

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

/**
 * Return the old JIRA < 6.3.x stored license. Since 6.4 the location of the licenses has moved.
 *
 * @return the license stored in the < 6.3.x location or {@link Option#none()} if no such license exists.
 */
private Option<License> retrieveOldLicense()
{
  return retrieveOldLicenseString().map(License::new);
}

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

private Option<JiraPluginApplicationMetaData> getMetadataForApplication(ApplicationKey appKey)
  {
    return metaDataManager.getApplication(appKey).map(JiraPluginApplicationMetaData.class::cast);
  }
}

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

@Override
public Option<ApplicationAccess> getAccess(final ApplicationKey key)
{
  return getApplication(key).map(Application::getAccess);
}

代码示例来源:origin: com.atlassian.plugins/base-hipchat-integration-plugin-api

@Override
public Option<String> getGroupName() {
  return hipChatLinkProvider.getDefaultLink().map(new Function<HipChatLink, String>() {
    @Override
    public String apply(HipChatLink input) {
      return input.getGroupName();
    }
  });
}

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

@Nonnull
@Override
public Set<Group> getDefaultGroups(@Nonnull final ApplicationKey key)
{
  final Supplier<Set<Group>> of = ImmutableSet::of;
  return getRole(key).map(ApplicationRole::getDefaultGroups).getOrElse(of);
}

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

@Nonnull
@Override
public Set<Group> getDefaultGroups(@Nonnull final ApplicationKey key)
{
  notNull("key", key);
  return getRole(key).map(ApplicationRole::getDefaultGroups).getOrElse(ImmutableSet.of());
}

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

/**
 * Return the Service Desk license stored in the UPM plugin store.
 *
 * @return the old Service Desk license from the UPM plugin store or {@link Option#none()}.
 */
private Option<License> retrieveOldSdLicense()
{
  return sdSupplier.get()
      .map(License::new)
      .filter(license -> license.isLicensed(ApplicationKeys.SERVICE_DESK));
}

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

@Override
public <A extends Application> Option<A> getApplication(final ApplicationKey key, final Class<A> type)
{
  return getApplication(key).filter(type::isInstance).map(type::cast);
}

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

@Override
public Option<RecordRequest> onGroupDeletedEvent(final GroupDeletedEvent event)
{
  return ifGroupNotHidden(event, event.getGroupName()).map(new Function<GroupDeletedEvent, RecordRequest>()
  {
    @Override
    public RecordRequest apply(GroupDeletedEvent event)
    {
      return new RecordRequest(AuditingCategory.GROUP_MANAGEMENT, "jira.auditing.group.deleted")
          .forObject(new AffectedGroup(event.getGroupName(), event.getDirectory()));
    }
  });
}

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

@Override
public Clause visit(final TerminalClause clause)
{
  return queryRegistry.getClauseQueryFactory(queryCreationContext, clause).map(new Function<WorklogClauseQueryFactory, Clause>()
  {
    @Override
    public Clause apply(final WorklogClauseQueryFactory input)
    {
      return toIssueSet(input.getWorklogQuery(queryCreationContext, clause));
    }
  }).getOrElse(clause);
}

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

private Stream<JiraApplication> getJiraApplicationFor(Application application)
{
  return getMetadataForApplication(application.getKey())
      .map(meta -> new JiraApplication(application, meta.getProjectTypes()))
      .map(Stream::of)
      .getOrElse(Stream.empty());
}

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

private Either<IOException, Option<Properties>> tryLoadProperties(final Supplier<Option<InputStream>> resourceSupplier)
{
  final Option<InputStream> streamOption = resourceSupplier.get();
  final Supplier<Either<IOException, Option<Properties>>> emptyPropertiesSupplier =
      () -> Either.<IOException, Option<Properties>>right(Option.none());
  return streamOption.map(this::tryLoadProperties).
      getOrElse(emptyPropertiesSupplier);
}

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

private String getApplicationDisplayName(final ApplicationKey applicationKey)
{
  return applicationManager.getApplication(applicationKey).map(Application::getName)
      .getOrElse(applicationRoleManager.getRole(applicationKey).map(ApplicationRole::getName)
          .getOrElse(applicationKey.toString()));
}

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

@Override
@Nonnull
public Option<String> getHelpSpace(@Nonnull final ApplicationKey applicationKey)
{
  return applicationManager.getApplication(applicationKey)
      .flatMap(app -> featureManager.isOnDemand() ? app.getProductHelpCloudSpaceURI() : app.getProductHelpServerSpaceURI())
      .map(uri -> uri.toString());
}

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

private String getDefaultGroupName(final ApplicationKey applicationKey)
{
  return toGroupName(applicationManager.getApplication(applicationKey).map(Application::getDefaultGroup)
      .getOrElse((Supplier<String>) () -> String.format("%s-users", applicationKey.value())));
}

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

@Override
Option<License> get6xLicense()
{
  try
  {
    return Option.option(stripToNull(properties.getText(APKeys.JIRA_LICENSE))).map(License::new);
  }
  catch (MigrationFailedException e)
  {
    throw new MigrationFailedException("JIRA 6.x license stored in JIRA is not valid: " + e.getMessage(), e);
  }
}

相关文章