Polishing
This commit is contained in:
parent
89f6e8ec49
commit
f285971cb3
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -264,7 +264,7 @@ public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationSt
|
|||
|
||||
/**
|
||||
* CGLIB MethodInterceptor to override methods, replacing them with a call
|
||||
* to a generic MethodReplacer.
|
||||
* to a generic {@link MethodReplacer}.
|
||||
*/
|
||||
private static class ReplaceOverrideMethodInterceptor extends CglibIdentitySupport implements MethodInterceptor {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -49,7 +49,7 @@ public class LookupOverride extends MethodOverride {
|
|||
|
||||
|
||||
/**
|
||||
* Construct a new LookupOverride.
|
||||
* Construct a new {@code LookupOverride}.
|
||||
* @param methodName the name of the method to override
|
||||
* @param beanName the name of the bean in the current {@code BeanFactory} that the
|
||||
* overridden method should return (may be {@code null} for type-based bean retrieval)
|
||||
|
@ -60,7 +60,7 @@ public class LookupOverride extends MethodOverride {
|
|||
}
|
||||
|
||||
/**
|
||||
* Construct a new LookupOverride.
|
||||
* Construct a new {@code LookupOverride}.
|
||||
* @param method the method declaration to override
|
||||
* @param beanName the name of the bean in the current {@code BeanFactory} that the
|
||||
* overridden method should return (may be {@code null} for type-based bean retrieval)
|
||||
|
@ -73,7 +73,7 @@ public class LookupOverride extends MethodOverride {
|
|||
|
||||
|
||||
/**
|
||||
* Return the name of the bean that should be returned by this method.
|
||||
* Return the name of the bean that should be returned by this {@code LookupOverride}.
|
||||
*/
|
||||
@Nullable
|
||||
public String getBeanName() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.beans.factory.support;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.beans.BeanMetadataElement;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
@ -107,13 +108,13 @@ public abstract class MethodOverride implements BeanMetadataElement {
|
|||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof MethodOverride that &&
|
||||
ObjectUtils.nullSafeEquals(this.methodName, that.methodName) &&
|
||||
this.methodName.equals(that.methodName) &&
|
||||
ObjectUtils.nullSafeEquals(this.source, that.source)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHash(this.methodName, this.source);
|
||||
return Objects.hash(this.methodName, this.source);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -19,10 +19,10 @@ package org.springframework.beans.factory.support;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Extension of {@link MethodOverride} that represents an arbitrary
|
||||
|
@ -97,22 +97,19 @@ public class ReplaceOverride extends MethodOverride {
|
|||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (other instanceof ReplaceOverride that && super.equals(other) &&
|
||||
ObjectUtils.nullSafeEquals(this.methodReplacerBeanName, that.methodReplacerBeanName) &&
|
||||
ObjectUtils.nullSafeEquals(this.typeIdentifiers, that.typeIdentifiers));
|
||||
return (other instanceof ReplaceOverride that && super.equals(that) &&
|
||||
this.methodReplacerBeanName.equals(that.methodReplacerBeanName) &&
|
||||
this.typeIdentifiers.equals(that.typeIdentifiers));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = super.hashCode();
|
||||
hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(this.methodReplacerBeanName);
|
||||
hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(this.typeIdentifiers);
|
||||
return hashCode;
|
||||
return Objects.hash(this.methodReplacerBeanName, this.typeIdentifiers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Replace override for method '" + getMethodName() + "'";
|
||||
return "ReplaceOverride for method '" + getMethodName() + "'";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue