/** * Return method model for the given method on consumer side * * @param method method object * @return method model */ public ConsumerMethodModel getMethodModel(String method) { Optional<Map.Entry<Method, ConsumerMethodModel>> consumerMethodModelEntry = methodModels.entrySet().stream().filter(entry -> entry.getKey().getName().equals(method)).findFirst(); return consumerMethodModelEntry.map(Map.Entry::getValue).orElse(null); }
public static int getConsumerAddressNum(String serviceUniqueName) { Set<ConsumerInvokerWrapper> providerInvokerWrapperSet = ProviderConsumerRegTable.getConsumerInvoker(serviceUniqueName); return providerInvokerWrapperSet.stream() .map(w -> w.getRegistryDirectory().getUrlInvokerMap()) .filter(Objects::nonNull) .mapToInt(Map::size).sum(); } }
/** * Return declared "producible" types but only among those that also * match the "methods" and "consumes" conditions. */ public Set<MediaType> getProducibleMediaTypes() { return this.partialMatches.stream().filter(PartialMatch::hasConsumesMatch). flatMap(m -> m.getInfo().getProducesCondition().getProducibleMediaTypes().stream()). collect(Collectors.toCollection(LinkedHashSet::new)); }
public static ActualProperties deriveProperties(PlanNode node, List<ActualProperties> inputProperties, Metadata metadata, Session session, TypeProvider types, SqlParser parser) { ActualProperties output = node.accept(new Visitor(metadata, session, types, parser), inputProperties); output.getNodePartitioning().ifPresent(partitioning -> verify(node.getOutputSymbols().containsAll(partitioning.getColumns()), "Node-level partitioning properties contain columns not present in node's output")); verify(node.getOutputSymbols().containsAll(output.getConstants().keySet()), "Node-level constant properties contain columns not present in node's output"); Set<Symbol> localPropertyColumns = output.getLocalProperties().stream() .flatMap(property -> property.getColumns().stream()) .collect(Collectors.toSet()); verify(node.getOutputSymbols().containsAll(localPropertyColumns), "Node-level local properties contain columns not present in node's output"); return output; }
/** * Return method model for the given method on consumer side * * @param method method object * @return method model */ public ConsumerMethodModel getMethodModel(String method) { Optional<Map.Entry<Method, ConsumerMethodModel>> consumerMethodModelEntry = methodModels.entrySet().stream().filter(entry -> entry.getKey().getName().equals(method)).findFirst(); return consumerMethodModelEntry.map(Map.Entry::getValue).orElse(null); }
public static int getConsumerAddressNum(String serviceUniqueName) { Set<ConsumerInvokerWrapper> providerInvokerWrapperSet = ProviderConsumerRegTable.getConsumerInvoker(serviceUniqueName); return providerInvokerWrapperSet.stream() .map(w -> w.getRegistryDirectory().getUrlInvokerMap()) .filter(Objects::nonNull) .mapToInt(Map::size).sum(); } }
/** * Return declared "consumable" types but only among those that also * match the "methods" condition. */ public Set<MediaType> getConsumableMediaTypes() { return this.partialMatches.stream().filter(PartialMatch::hasMethodsMatch). flatMap(m -> m.getInfo().getConsumesCondition().getConsumableMediaTypes().stream()). collect(Collectors.toCollection(LinkedHashSet::new)); }
private String formatMappings(Class<?> userType, Map<Method, T> methods) { String formattedType = Arrays.stream(ClassUtils.getPackageName(userType).split("\\.")) .map(p -> p.substring(0, 1)) .collect(Collectors.joining(".", "", ".")) + userType.getSimpleName(); Function<Method, String> methodFormatter = method -> Arrays.stream(method.getParameterTypes()) .map(Class::getSimpleName) .collect(Collectors.joining(",", "(", ")")); return methods.entrySet().stream() .map(e -> { Method method = e.getKey(); return e.getValue() + ": " + method.getName() + methodFormatter.apply(method); }) .collect(Collectors.joining("\n\t", "\n\t" + formattedType + ":" + "\n\t", "")); }
/** * Configure path prefixes to apply to controller methods. * <p>Prefixes are used to enrich the mappings of every {@code @RequestMapping} * method whose controller type is matched by a corresponding * {@code Predicate} in the map. The prefix for the first matching predicate * is used, assuming the input map has predictable order. * <p>Consider using {@link org.springframework.web.method.HandlerTypePredicate * HandlerTypePredicate} to group controllers. * @param prefixes a map with path prefixes as key * @since 5.1 * @see org.springframework.web.method.HandlerTypePredicate */ public void setPathPrefixes(Map<String, Predicate<Class<?>>> prefixes) { this.pathPrefixes.clear(); prefixes.entrySet().stream() .filter(entry -> StringUtils.hasText(entry.getKey())) .forEach(entry -> this.pathPrefixes.put(entry.getKey(), entry.getValue())); }