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

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

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

Option.getOrError介绍

暂无

代码示例

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

private void dispatchViaSoyView(final HttpServletResponse httpServletResponse, final ActionResult ar, Option<ActionInfo.ViewInfo> viewInfo)
    throws ServletException, IOException
{
  soyViewDispatcher.dispatch(httpServletResponse, ar, viewInfo.getOrError(ASSERTION_CANT_BE_NONE));
}

代码示例来源:origin: com.atlassian.asap/asap-java

private AuthenticationContext getAuthenticationContext()
{
  return getBeanForClass(AuthenticationContext.class)
      .getOrError(Suppliers.ofInstance(
          "Unable to find unique bean of type " + AuthenticationContext.class.getName() + " " +
              "in your Spring configuration"
      ));
}

代码示例来源:origin: com.atlassian.asap/asap-java

@VisibleForTesting
Predicate<String> getAuthorizedSubjectPredicate()
{
  Iterable<String> iterable =
      getAuthorizedSubjectsIterableFromFilterConfig()
          .orElse(getAuthorizedSubjectsIterableFromSpring())
          .getOrError(Suppliers.ofInstance(
              "Missing bean with name " + AUTHORIZED_SUBJECTS_BEAN_NAME +
                  " or servlet filter init-param with key " + AUTHORIZED_SUBJECTS_INIT_PARAM_KEY
          ));
  return Predicates.in(ImmutableList.copyOf(iterable));
}

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

private String renderCommentFields(final DescriptorToHtmlFunction descriptorToHtmlFunction, final CommentHelper commentHelper)
{
  Iterable<CommentFieldRendererModuleDescriptor> descriptors = pluginAccessor.getEnabledModuleDescriptorsByClass(CommentFieldRendererModuleDescriptor.class);
  List<CommentFieldRendererModuleDescriptor> descriptorsOrderedByWeight = commentFieldRendererModuleDescriptorOrdering.sortedCopy(descriptors);
  // Complicated? Not really. We get all renders for which want to be displayed (according to the condition).
  // Then, transform all this to optional html (there might be no definition of field-view-resource, when we would get none).
  // Finally, pick the first non empty html.
  final Option<String> commentFieldToRender = getFirst(Options.filterNone(transform(filter(descriptorsOrderedByWeight, SafePluginPointAccess.safe(new Predicate<CommentFieldRendererModuleDescriptor>()
  {
    @Override
    public boolean apply(final CommentFieldRendererModuleDescriptor moduleDescriptor) {
      return moduleDescriptor.getCondition() == null || moduleDescriptor.getCondition().shouldDisplay(commentHelper.getContextParams());
    }
  })), SafePluginPointAccess.safe(descriptorToHtmlFunction))), Option.<String>none());
  return commentFieldToRender.getOrError(new Supplier<String>()
  {
    @Override
    public String get()
    {
      throw new IllegalStateException("There should be at least one comment field renderer, which can render the comments");
    }
  });
}

相关文章