/** * Direct method lookup filtering on exact method name, parameter count and parameter types. * * @return direct method lookup. */ public static MethodLookup direct() { MethodPredicate direct = (invoked, candidate) -> candidate.getName().equals(invoked.getName()) && candidate.getParameterCount() == invoked.getParameterCount() && Arrays.equals(candidate.getParameterTypes(), invoked.getParameterTypes()) && candidate.getReturnType().equals(invoked.getMethod().getReturnType()); return () -> Collections.singletonList(direct); }
@Override public List<MethodPredicate> getLookups() { MethodPredicate detailedComparison = (invoked, candidate) -> Optional.of(candidate) .filter(baseClassMethod -> baseClassMethod.getName().equals(invoked.getName()))// Right name .filter(baseClassMethod -> baseClassMethod.getParameterCount() == invoked.getParameterCount()) .filter(baseClassMethod -> parametersMatch(invoked.getMethod(), baseClassMethod))// All parameters match .isPresent(); return Collections.singletonList(detailedComparison); }
@Override public List<MethodPredicate> getLookups() { MethodPredicate detailedComparison = (invoked, candidate) -> Optional.of(candidate) .filter(baseClassMethod -> baseClassMethod.getName().equals(invoked.getName()))// Right name .filter(baseClassMethod -> baseClassMethod.getParameterCount() == invoked.getParameterCount()) .filter(baseClassMethod -> parametersMatch(invoked.getMethod(), baseClassMethod))// All parameters match .isPresent(); return Collections.singletonList(detailedComparison); }
/** * Returns a candidate method from the base class for the given one or the method given in the first place if none * one the base class matches. * * @param method must not be {@literal null}. * @param baseClass must not be {@literal null}. * @param predicate must not be {@literal null}. * @return */ private static Optional<Method> getMethodCandidate(InvokedMethod invokedMethod, Method candidate, Predicate<ParameterOverrideCriteria> predicate) { return Optional.of(candidate)// .filter(it -> invokedMethod.getName().equals(it.getName()))// .filter(it -> invokedMethod.getParameterCount() == it.getParameterCount())// .filter(it -> parametersMatch(it, invokedMethod.getMethod(), predicate)); }
/** * Returns a candidate method from the base class for the given one or the method given in the first place if none * one the base class matches. * * @param method must not be {@literal null}. * @param baseClass must not be {@literal null}. * @param predicate must not be {@literal null}. * @return */ private static Optional<Method> getMethodCandidate(InvokedMethod invokedMethod, Method candidate, Predicate<ParameterOverrideCriteria> predicate) { return Optional.of(candidate)// .filter(it -> invokedMethod.getName().equals(it.getName()))// .filter(it -> invokedMethod.getParameterCount() == it.getParameterCount())// .filter(it -> parametersMatch(it, invokedMethod.getMethod(), predicate)); }
/** * Returns a candidate method from the base class for the given one or the method given in the first place if none * one the base class matches. * * @param method must not be {@literal null}. * @param baseClass must not be {@literal null}. * @param predicate must not be {@literal null}. * @return */ private static Optional<Method> getMethodCandidate(InvokedMethod invokedMethod, Method candidate, Predicate<ParameterOverrideCriteria> predicate) { return Optional.of(candidate)// .filter(it -> invokedMethod.getName().equals(it.getName()))// .filter(it -> invokedMethod.getParameterCount() == it.getParameterCount())// .filter(it -> parametersMatch(it, invokedMethod.getMethod(), predicate)); }
/** * Returns a candidate method from the base class for the given one or the method given in the first place if none * one the base class matches. * * @param method must not be {@literal null}. * @param baseClass must not be {@literal null}. * @param predicate must not be {@literal null}. * @return */ private static Optional<Method> getMethodCandidate(InvokedMethod invokedMethod, Method candidate, Predicate<ParameterOverrideCriteria> predicate) { return Optional.of(candidate)// .filter(it -> invokedMethod.getName().equals(it.getName()))// .filter(it -> invokedMethod.getParameterCount() == it.getParameterCount())// .filter(it -> parametersMatch(it, invokedMethod.getMethod(), predicate)); }
/** * Returns a candidate method from the base class for the given one or the method given in the first place if none * one the base class matches. * * @param method must not be {@literal null}. * @param baseClass must not be {@literal null}. * @param predicate must not be {@literal null}. * @return */ private static Optional<Method> getMethodCandidate(InvokedMethod invokedMethod, Method candidate, Predicate<ParameterOverrideCriteria> predicate) { return Optional.of(candidate)// .filter(it -> invokedMethod.getName().equals(it.getName()))// .filter(it -> invokedMethod.getParameterCount() == it.getParameterCount())// .filter(it -> parametersMatch(it, invokedMethod.getMethod(), predicate)); }
/** * Returns a candidate method from the base class for the given one or the method given in the first place if none * one the base class matches. * * @param method must not be {@literal null}. * @param baseClass must not be {@literal null}. * @param predicate must not be {@literal null}. * @return */ private static Optional<Method> getMethodCandidate(InvokedMethod invokedMethod, Method candidate, Predicate<ParameterOverrideCriteria> predicate) { return Optional.of(candidate)// .filter(it -> invokedMethod.getName().equals(it.getName()))// .filter(it -> invokedMethod.getParameterCount() == it.getParameterCount())// .filter(it -> parametersMatch(it, invokedMethod.getMethod(), predicate)); }
@Override public List<MethodPredicate> getLookups() { MethodPredicate detailedComparison = (invoked, candidate) -> Optional.of(candidate) .filter(baseClassMethod -> baseClassMethod.getName().equals(invoked.getName()))// Right name .filter(baseClassMethod -> baseClassMethod.getParameterCount() == invoked.getParameterCount()) .filter(baseClassMethod -> parametersMatch(invoked.getMethod(), baseClassMethod))// All parameters match .isPresent(); return Collections.singletonList(detailedComparison); }
/** * Direct method lookup filtering on exact method name, parameter count and parameter types. * * @return direct method lookup. */ public static MethodLookup direct() { MethodPredicate direct = (invoked, candidate) -> candidate.getName().equals(invoked.getName()) && candidate.getParameterCount() == invoked.getParameterCount() && Arrays.equals(candidate.getParameterTypes(), invoked.getParameterTypes()) && candidate.getReturnType().equals(invoked.getMethod().getReturnType()); return () -> Collections.singletonList(direct); }
@Override public List<MethodPredicate> getLookups() { MethodPredicate detailedComparison = (invoked, candidate) -> Optional.of(candidate) .filter(baseClassMethod -> baseClassMethod.getName().equals(invoked.getName()))// Right name .filter(baseClassMethod -> baseClassMethod.getParameterCount() == invoked.getParameterCount()) .filter(baseClassMethod -> parametersMatch(invoked.getMethod(), baseClassMethod))// All parameters match .isPresent(); return Collections.singletonList(detailedComparison); }
/** * Direct method lookup filtering on exact method name, parameter count and parameter types. * * @return direct method lookup. */ public static MethodLookup direct() { MethodPredicate direct = (invoked, candidate) -> candidate.getName().equals(invoked.getName()) && candidate.getParameterCount() == invoked.getParameterCount() && Arrays.equals(candidate.getParameterTypes(), invoked.getParameterTypes()) && candidate.getReturnType().equals(invoked.getMethod().getReturnType()); return () -> Collections.singletonList(direct); }
/** * Direct method lookup filtering on exact method name, parameter count and parameter types. * * @return direct method lookup. */ public static MethodLookup direct() { MethodPredicate direct = (invoked, candidate) -> candidate.getName().equals(invoked.getName()) && candidate.getParameterCount() == invoked.getParameterCount() && Arrays.equals(candidate.getParameterTypes(), invoked.getParameterTypes()); return () -> Collections.singletonList(direct); }
@Override public List<MethodPredicate> getLookups() { MethodPredicate detailedComparison = (invoked, candidate) -> Optional.of(candidate) .filter(baseClassMethod -> baseClassMethod.getName().equals(invoked.getName()))// Right name .filter(baseClassMethod -> baseClassMethod.getParameterCount() == invoked.getParameterCount()) .filter(baseClassMethod -> parametersMatch(invoked.getMethod(), baseClassMethod))// All parameters match .isPresent(); return Collections.singletonList(detailedComparison); }
/** * Direct method lookup filtering on exact method name, parameter count and parameter types. * * @return direct method lookup. */ public static MethodLookup direct() { MethodPredicate direct = (invoked, candidate) -> candidate.getName().equals(invoked.getName()) && candidate.getParameterCount() == invoked.getParameterCount() && Arrays.equals(candidate.getParameterTypes(), invoked.getParameterTypes()) && candidate.getReturnType().equals(invoked.getMethod().getReturnType()); return () -> Collections.singletonList(direct); }
@Override public List<MethodPredicate> getLookups() { MethodPredicate detailedComparison = (invoked, candidate) -> Optional.of(candidate) .filter(baseClassMethod -> baseClassMethod.getName().equals(invoked.getName()))// Right name .filter(baseClassMethod -> baseClassMethod.getParameterCount() == invoked.getParameterCount()) .filter(baseClassMethod -> parametersMatch(invoked.getMethod(), baseClassMethod))// All parameters match .isPresent(); return Collections.singletonList(detailedComparison); }
/** * Direct method lookup filtering on exact method name, parameter count and parameter types. * * @return direct method lookup. */ public static MethodLookup direct() { MethodPredicate direct = (invoked, candidate) -> candidate.getName().equals(invoked.getName()) && candidate.getParameterCount() == invoked.getParameterCount() && Arrays.equals(candidate.getParameterTypes(), invoked.getParameterTypes()); return () -> Collections.singletonList(direct); }