@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof AdviceExcludingMethodMatcher)) { return false; } AdviceExcludingMethodMatcher otherMm = (AdviceExcludingMethodMatcher) other; return this.adviceMethod.equals(otherMm.adviceMethod); }
@Override public boolean matches(Method method, Class<?> targetClass) { return !this.adviceMethod.equals(method); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof HandlerMethod)) { return false; } HandlerMethod otherMethod = (HandlerMethod) other; return (this.bean.equals(otherMethod.bean) && this.method.equals(otherMethod.method)); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof MethodClassKey)) { return false; } MethodClassKey otherKey = (MethodClassKey) other; return (this.method.equals(otherKey.method) && ObjectUtils.nullSafeEquals(this.targetClass, otherKey.targetClass)); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof HandlerMethod)) { return false; } HandlerMethod otherMethod = (HandlerMethod) other; return (this.bean.equals(otherMethod.bean) && this.method.equals(otherMethod.method)); }
/** * @return True if the input object is a DelegatingMethod which has an internal Method which is equal to the internal Method of this DelegatingMethod, * or if the input object is a Method which is equal to the internal Method of this DelegatingMethod. */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof DelegatingMethod) { DelegatingMethod that = (DelegatingMethod) o; return method.equals(that.method); } else { return method.equals(o); } }
private void addExceptionMapping(Class<? extends Throwable> exceptionType, Method method) { Method oldMethod = this.mappedMethods.put(exceptionType, method); if (oldMethod != null && !oldMethod.equals(method)) { throw new IllegalStateException("Ambiguous @ExceptionHandler method mapped for [" + exceptionType + "]: {" + oldMethod + ", " + method + "}"); } }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AndroidTrustRootIndex)) { return false; } AndroidTrustRootIndex that = (AndroidTrustRootIndex) obj; return trustManager.equals(that.trustManager) && findByIssuerAndSignatureMethod.equals(that.findByIssuerAndSignatureMethod); }
@Override public boolean equals(Object obj) { if (!FrameworkMethod.class.isInstance(obj)) { return false; } return ((FrameworkMethod) obj).method.equals(method); }
/** * Returns {@code true} if the supplied '{@code candidateMethod}' can be * consider a validate candidate for the {@link Method} that is {@link Method#isBridge() bridged} * by the supplied {@link Method bridge Method}. This method performs inexpensive * checks and can be used quickly filter for a set of possible matches. */ private static boolean isBridgedCandidateFor(Method candidateMethod, Method bridgeMethod) { return (!candidateMethod.isBridge() && !candidateMethod.equals(bridgeMethod) && candidateMethod.getName().equals(bridgeMethod.getName()) && candidateMethod.getParameterCount() == bridgeMethod.getParameterCount()); }
@Override public final boolean equals(@Nullable Object obj) { if (obj instanceof Subscriber) { Subscriber that = (Subscriber) obj; // Use == so that different equal instances will still receive events. // We only guard against the case that the same object is registered // multiple times return target == that.target && method.equals(that.method); } return false; }
/** * Find a JavaBeans {@code PropertyDescriptor} for the given method, * with the method either being the read method or the write method for * that bean property. * @param method the method to find a corresponding PropertyDescriptor for * @param clazz the (most specific) class to introspect for descriptors * @return the corresponding PropertyDescriptor, or {@code null} if none * @throws BeansException if PropertyDescriptor lookup fails * @since 3.2.13 */ @Nullable public static PropertyDescriptor findPropertyForMethod(Method method, Class<?> clazz) throws BeansException { Assert.notNull(method, "Method must not be null"); PropertyDescriptor[] pds = getPropertyDescriptors(clazz); for (PropertyDescriptor pd : pds) { if (method.equals(pd.getReadMethod()) || method.equals(pd.getWriteMethod())) { return pd; } } return null; }
private List<AliasDescriptor> getOtherDescriptors() { List<AliasDescriptor> otherDescriptors = new ArrayList<>(); for (Method currentAttribute : getAttributeMethods(this.sourceAnnotationType)) { if (!this.sourceAttribute.equals(currentAttribute)) { AliasDescriptor otherDescriptor = AliasDescriptor.from(currentAttribute); if (otherDescriptor != null) { otherDescriptors.add(otherDescriptor); } } } return otherDescriptors; }
@Override public final boolean equals(@NullableDecl Object obj) { if (obj instanceof Subscriber) { Subscriber that = (Subscriber) obj; // Use == so that different equal instances will still receive events. // We only guard against the case that the same object is registered // multiple times return target == that.target && method.equals(that.method); } return false; }
/** * Match the specified method by {@link Method} reference or method name. * <p>For backwards compatibility reasons, in a scenario with overloaded * non-abstract methods of the given name, only the no-arg variant of a * method will be turned into a container-driven lookup method. * <p>In case of a provided {@link Method}, only straight matches will * be considered, usually demarcated by the {@code @Lookup} annotation. */ @Override public boolean matches(Method method) { if (this.method != null) { return method.equals(this.method); } else { return (method.getName().equals(getMethodName()) && (!isOverloaded() || Modifier.isAbstract(method.getModifiers()) || method.getParameterCount() == 0)); } }
/** * Checks if the method defined on the base type with the given arguments * is overridden in the given derived type. */ public static boolean isOverridden(@Nonnull Class base, @Nonnull Class derived, @Nonnull String methodName, @Nonnull Class... types) { return !getMethod(base, methodName, types).equals(getMethod(derived, methodName, types)); }
private static Map<Class<? extends Throwable>, Method> initExceptionMappings(Class<?> handlerType) { Map<Method, MessageExceptionHandler> methods = MethodIntrospector.selectMethods(handlerType, (MethodIntrospector.MetadataLookup<MessageExceptionHandler>) method -> AnnotatedElementUtils.findMergedAnnotation(method, MessageExceptionHandler.class)); Map<Class<? extends Throwable>, Method> result = new HashMap<>(); for (Map.Entry<Method, MessageExceptionHandler> entry : methods.entrySet()) { Method method = entry.getKey(); List<Class<? extends Throwable>> exceptionTypes = new ArrayList<>(); exceptionTypes.addAll(Arrays.asList(entry.getValue().value())); if (exceptionTypes.isEmpty()) { exceptionTypes.addAll(getExceptionsFromMethodSignature(method)); } for (Class<? extends Throwable> exceptionType : exceptionTypes) { Method oldMethod = result.put(exceptionType, method); if (oldMethod != null && !oldMethod.equals(method)) { throw new IllegalStateException("Ambiguous @ExceptionHandler method mapped for [" + exceptionType + "]: {" + oldMethod + ", " + method + "}"); } } } return result; }
/** * Determine if this descriptor and the supplied descriptor both * effectively represent aliases for the same attribute in the same * target annotation, either explicitly or implicitly. * <p>This method searches the attribute override hierarchy, beginning * with this descriptor, in order to detect implicit and transitively * implicit aliases. * @return {@code true} if this descriptor and the supplied descriptor * effectively alias the same annotation attribute * @see #isOverrideFor */ private boolean isAliasFor(AliasDescriptor otherDescriptor) { for (AliasDescriptor lhs = this; lhs != null; lhs = lhs.getAttributeOverrideDescriptor()) { for (AliasDescriptor rhs = otherDescriptor; rhs != null; rhs = rhs.getAttributeOverrideDescriptor()) { if (lhs.aliasedAttribute.equals(rhs.aliasedAttribute)) { return true; } } } return false; }
/** * {@inheritDoc} */ public boolean represents(Method method) { return this.method.equals(method) || equals(new MethodDescription.ForLoadedMethod(method)); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return method.equals(getAllStatesMethod) ? getAllStates() : invokeListMethod(method, args); }