com.vaadin.flow.router.Route.value()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(118)

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

Route.value介绍

暂无

代码示例

代码示例来源:origin: appreciated/vaadin-app-layout

public DefaultNavigationElementInfoProducer() {
    super(info -> info.getAnnotation(Route.class).value());
  }
}

代码示例来源:origin: com.vaadin/flow-component-demo-helpers

private String getTabUrl(String relativeHref) {
  String href = relativeHref == null || relativeHref.isEmpty() ? ""
      : "/" + relativeHref;
  return getClass().getAnnotation(Route.class).value() + href;
}

代码示例来源:origin: appreciated/vaadin-app-layout

default int computeClosenessScore(Class<? extends HasElement> compare, Class<? extends HasElement> compare2) {
  String[] desiredRoute = getRoute(compare).get().value().split("/");
  String[] elementRoute = getRoute(compare2).map(route -> route.value().split("/")).orElse(null);
  int score = 0;
  for (; score < elementRoute.length; score++)
    if (desiredRoute.length >= score && !elementRoute[score].equals(desiredRoute[score])) {
      return score;
    }
  return score;
}

代码示例来源:origin: com.vaadin/flow-server

/**
   * Gets the effective route path value of the annotated class.
   *
   * @param component
   *            the component where the route points to
   * @param route
   *            the annotation
   * @return The value of the annotation or naming convention based value if
   *         no explicit value is given.
   */
  public static String resolve(Class<?> component, Route route) {
    if (route.value().equals(Route.NAMING_CONVENTION)) {
      String simpleName = component.getSimpleName();
      if ("MainView".equals(simpleName) || "Main".equals(simpleName)) {
        return "";
      }
      if (simpleName.endsWith("View")) {
        return simpleName
            .substring(0, simpleName.length() - "View".length())
            .toLowerCase();
      }
      return simpleName.toLowerCase();
    }
    return route.value();
  }
}

相关文章