test_class.declarator: ROUTE = new StdRoute("R1", new StdRestxRequestMatcher("GET", "/test")) {
          @Override
          public void handle(RestxRequestMatch match, RestxRequest req, RestxResponse resp, RestxContext ctx) throws IOException {
          }
  
          public String getName() {
              return "ROUTE";
          }
      }
test_class.modifier: public static final
test_class.original_string: public static final StdRoute ROUTE = new StdRoute("R1", new StdRestxRequestMatcher("GET", "/test")) {
          @Override
          public void handle(RestxRequestMatch match, RestxRequest req, RestxResponse resp, RestxContext ctx) throws IOException {
          }
  
          public String getName() {
              return "ROUTE";
          }
      };
test_class.type: StdRoute
test_class.var_name: ROUTE
test_class.file: restx-core/src/test/java/restx/RestxRoutingTest.java
test_class.identifier: RestxRoutingTest
test_case.body: @Test
      public void should_match_with_filters_in_order() throws Exception {
          RestxRouting routing = new RestxRouting(
                  ImmutableList.of(
                          NamedComponent.of(RestxFilter.class, "F1", 0, new TestFilter("F1"))),
                  ImmutableList.of(
                          NamedComponent.of(RestxRouteFilter.class, "RF1", -10, new TestRouteFilter("RF1")),
                          NamedComponent.of(RestxRouteFilter.class, "RF2", 10, new TestRouteFilter("RF2"))
                  ),
                  ImmutableList.<RestxRoute>of(ROUTE)
          );
  
          Optional<Match> m = routing.match(StdRequest.builder()
                  .setHttpMethod("GET").setRestxPath("/test").setBaseUri("http://localhost/api").build());
  
          assertThat(m.isPresent()).isTrue();
          assertThat(m.get().getMatches()).extracting("handler.name")
                  .containsExactly("RF1", "F1", "RF2", "ROUTE");
      }
test_case.class_method_signature: RestxRoutingTest.should_match_with_filters_in_order()
test_case.full_signature: @Test public void should_match_with_filters_in_order()
test_case.identifier: should_match_with_filters_in_order
test_case.invocations: of of of of of of match build setBaseUri setRestxPath setHttpMethod builder isTrue assertThat isPresent containsExactly extracting assertThat getMatches get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_match_with_filters_in_order()
focal_class.declarator: filters
focal_class.modifier: private final
focal_class.original_string: private final ImmutableList<NamedComponent<RestxFilter>> filters;
focal_class.type: ImmutableList<NamedComponent<RestxFilter>>
focal_class.var_name: filters
focal_class.declarator: routeFilters
focal_class.modifier: private final
focal_class.original_string: private final ImmutableMultimap<RestxRoute, NamedComponent<RestxHandlerMatch>> routeFilters;
focal_class.type: ImmutableMultimap<RestxRoute, NamedComponent<RestxHandlerMatch>>
focal_class.var_name: routeFilters
focal_class.declarator: routes
focal_class.modifier: private final
focal_class.original_string: private final ImmutableList<RestxRoute> routes;
focal_class.type: ImmutableList<RestxRoute>
focal_class.var_name: routes
focal_class.file: restx-core/src/main/java/restx/RestxRouting.java
focal_class.identifier: RestxRouting
focal_class.class_method_signature: RestxRouting.RestxRouting(ImmutableList<NamedComponent<RestxFilter>> filters,
                          ImmutableList<NamedComponent<RestxRouteFilter>> routeFilters,
                          ImmutableList<RestxRoute> routes)
focal_class.full_signature: public  RestxRouting(ImmutableList<NamedComponent<RestxFilter>> filters,
                          ImmutableList<NamedComponent<RestxRouteFilter>> routeFilters,
                          ImmutableList<RestxRoute> routes)
focal_class.identifier: RestxRouting
focal_class.modifiers: public
focal_class.parameters: (ImmutableList<NamedComponent<RestxFilter>> filters,
                          ImmutableList<NamedComponent<RestxRouteFilter>> routeFilters,
                          ImmutableList<RestxRoute> routes)
focal_class.signature:  RestxRouting(ImmutableList<NamedComponent<RestxFilter>> filters,
                          ImmutableList<NamedComponent<RestxRouteFilter>> routeFilters,
                          ImmutableList<RestxRoute> routes)
focal_class.class_method_signature: RestxRouting.getFilters()
focal_class.full_signature: public ImmutableList<RestxFilter> getFilters()
focal_class.identifier: getFilters
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ImmutableList<RestxFilter>
focal_class.signature: ImmutableList<RestxFilter> getFilters()
focal_class.class_method_signature: RestxRouting.getRouteFilters(RestxRoute route)
focal_class.full_signature: public ImmutableCollection<? extends RestxHandlerMatch> getRouteFilters(RestxRoute route)
focal_class.identifier: getRouteFilters
focal_class.modifiers: public
focal_class.parameters: (RestxRoute route)
focal_class.return: ImmutableCollection<? extends RestxHandlerMatch>
focal_class.signature: ImmutableCollection<? extends RestxHandlerMatch> getRouteFilters(RestxRoute route)
focal_class.class_method_signature: RestxRouting.getRoutes()
focal_class.full_signature: public ImmutableList<RestxRoute> getRoutes()
focal_class.identifier: getRoutes
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ImmutableList<RestxRoute>
focal_class.signature: ImmutableList<RestxRoute> getRoutes()
focal_class.class_method_signature: RestxRouting.match(RestxRequest restxRequest)
focal_class.full_signature: public Optional<Match> match(RestxRequest restxRequest)
focal_class.identifier: match
focal_class.modifiers: public
focal_class.parameters: (RestxRequest restxRequest)
focal_class.return: Optional<Match>
focal_class.signature: Optional<Match> match(RestxRequest restxRequest)
focal_method.body: public Optional<Match> match(RestxRequest restxRequest) {
          for (RestxRoute route : routes) {
              Optional<? extends RestxHandlerMatch> match = route.match(restxRequest);
              if (match.isPresent()) {
                  // here we need to:
                  // - check which filters apply
                  // - order all filters (route filters and regular filters) by priority
                  // so we put all matches as NamedComponents (to preserve the filter priority) in a list,
                  // and finally sort the list by priority before returning it as a Match
                  ImmutableCollection<NamedComponent<RestxHandlerMatch>> routeFilters = this.routeFilters.get(route);
  
                  List<NamedComponent<RestxHandlerMatch>> matches = Lists.newArrayListWithCapacity(
                          filters.size() + routeFilters.size() + 1);
                  matches.addAll(routeFilters);
  
                  for (NamedComponent<RestxFilter> filter : filters) {
                      Optional<? extends RestxHandlerMatch> filterMatch = filter.getComponent().match(restxRequest);
                      if (filterMatch.isPresent()) {
                          matches.add(NamedComponent.of(
                                  RestxHandlerMatch.class, filter.getName().getName(),
                                  filter.getPriority(), filterMatch.get()));
                      }
                  }
  
                  return Optional.of(new Match(
                          ImmutableList.<RestxHandlerMatch>builder()
                                  .addAll(
                                          transform(Ordering.from(Factory.NAMED_COMPONENT_COMPARATOR).sortedCopy(matches),
                                                  NamedComponent.<RestxHandlerMatch>toComponent()))
                                  .add(match.get())
                                  .build(),
                          match));
              }
          }
          return Optional.absent();
      }
focal_method.class_method_signature: RestxRouting.match(RestxRequest restxRequest)
focal_method.full_signature: public Optional<Match> match(RestxRequest restxRequest)
focal_method.identifier: match
focal_method.invocations: match isPresent get newArrayListWithCapacity size size addAll match getComponent isPresent add of getName getName getPriority get of build add addAll builder transform sortedCopy from toComponent get absent
focal_method.modifiers: public
focal_method.parameters: (RestxRequest restxRequest)
focal_method.return: Optional<Match>
focal_method.signature: Optional<Match> match(RestxRequest restxRequest)