/** * Returns a composed {@link MethodLookup} that represents a concatenation of this predicate and another. When * evaluating the composed method lookup, if this lookup evaluates {@code true}, then the {@code other} method lookup * is not evaluated. * * @param other must not be {@literal null}. * @return the composed {@link MethodLookup}. */ default MethodLookup and(MethodLookup other) { Assert.notNull(other, "Other method lookup must not be null!"); return () -> Stream.concat(getLookups().stream(), other.getLookups().stream()).collect(Collectors.toList()); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link RepositoryAwareMethodLookup}. * <p/> * Repository-aware lookups resolve generic types from the repository declaration to verify assignability to Id/domain * types. This lookup also permits assignable method signatures but prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() */ public static MethodLookup forRepositoryTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new RepositoryAwareMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link RepositoryAwareMethodLookup}. * <p/> * Repository-aware lookups resolve generic types from the repository declaration to verify assignability to Id/domain * types. This lookup also permits assignable method signatures but prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() */ public static MethodLookup forRepositoryTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new RepositoryAwareMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link RepositoryAwareMethodLookup}. * <p/> * Repository-aware lookups resolve generic types from the repository declaration to verify assignability to Id/domain * types. This lookup also permits assignable method signatures but prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() */ public static MethodLookup forRepositoryTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new RepositoryAwareMethodLookup(repositoryMetadata)); }
private static Optional<Method> findMethod(InvokedMethod invokedMethod, MethodLookup lookup, Supplier<Stream<Method>> methodStreamSupplier) { for (MethodPredicate methodPredicate : lookup.getLookups()) { Optional<Method> resolvedMethod = methodStreamSupplier.get() .filter(it -> methodPredicate.test(invokedMethod, it)) // .findFirst(); if (resolvedMethod.isPresent()) { return resolvedMethod; } } return Optional.empty(); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link RepositoryAwareMethodLookup}. * <p/> * Repository-aware lookups resolve generic types from the repository declaration to verify assignability to Id/domain * types. This lookup also permits assignable method signatures but prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() */ public static MethodLookup forRepositoryTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new RepositoryAwareMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link RepositoryAwareMethodLookup}. * <p/> * Repository-aware lookups resolve generic types from the repository declaration to verify assignability to Id/domain * types. This lookup also permits assignable method signatures but prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() */ public static MethodLookup forRepositoryTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new RepositoryAwareMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link RepositoryAwareMethodLookup}. * <p/> * Repository-aware lookups resolve generic types from the repository declaration to verify assignability to Id/domain * types. This lookup also permits assignable method signatures but prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() */ public static MethodLookup forRepositoryTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new RepositoryAwareMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link ReactiveTypeInteropMethodLookup}. * <p/> * This method lookup considers adaptability of reactive types in method signatures. Repository methods accepting a * reactive type can be possibly called with a different reactive type if the reactive type can be adopted to the * target type. This lookup also permits assignable method signatures and resolves repository id/entity types but * prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() * @see #forRepositoryTypes(RepositoryMetadata) */ public static MethodLookup forReactiveTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new ReactiveTypeInteropMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link ReactiveTypeInteropMethodLookup}. * <p/> * This method lookup considers adaptability of reactive types in method signatures. Repository methods accepting a * reactive type can be possibly called with a different reactive type if the reactive type can be adopted to the * target type. This lookup also permits assignable method signatures and resolves repository id/entity types but * prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() * @see #forRepositoryTypes(RepositoryMetadata) */ public static MethodLookup forReactiveTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new ReactiveTypeInteropMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link ReactiveTypeInteropMethodLookup}. * <p/> * This method lookup considers adaptability of reactive types in method signatures. Repository methods accepting a * reactive type can be possibly called with a different reactive type if the reactive type can be adopted to the * target type. This lookup also permits assignable method signatures and resolves repository id/entity types but * prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() * @see #forRepositoryTypes(RepositoryMetadata) */ public static MethodLookup forReactiveTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new ReactiveTypeInteropMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link ReactiveTypeInteropMethodLookup}. * <p/> * This method lookup considers adaptability of reactive types in method signatures. Repository methods accepting a * reactive type can be possibly called with a different reactive type if the reactive type can be adopted to the * target type. This lookup also permits assignable method signatures and resolves repository id/entity types but * prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() * @see #forRepositoryTypes(RepositoryMetadata) */ public static MethodLookup forReactiveTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new ReactiveTypeInteropMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link ReactiveTypeInteropMethodLookup}. * <p/> * This method lookup considers adaptability of reactive types in method signatures. Repository methods accepting a * reactive type can be possibly called with a different reactive type if the reactive type can be adopted to the * target type. This lookup also permits assignable method signatures and resolves repository id/entity types but * prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() * @see #forRepositoryTypes(RepositoryMetadata) */ public static MethodLookup forReactiveTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new ReactiveTypeInteropMethodLookup(repositoryMetadata)); }
/** * Repository type-aware method lookup composed of {@link #direct()} and {@link ReactiveTypeInteropMethodLookup}. * <p/> * This method lookup considers adaptability of reactive types in method signatures. Repository methods accepting a * reactive type can be possibly called with a different reactive type if the reactive type can be adopted to the * target type. This lookup also permits assignable method signatures and resolves repository id/entity types but * prefers {@link #direct()} matches. * * @param repositoryMetadata must not be {@literal null}. * @return the composed, repository-aware method lookup. * @see #direct() * @see #forRepositoryTypes(RepositoryMetadata) */ public static MethodLookup forReactiveTypes(RepositoryMetadata repositoryMetadata) { return direct().and(new ReactiveTypeInteropMethodLookup(repositoryMetadata)); }