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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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
|
* 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 {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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 methodName the name of the method to override
|
||||||
* @param beanName the name of the bean in the current {@code BeanFactory} that the
|
* @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)
|
* 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 method the method declaration to override
|
||||||
* @param beanName the name of the bean in the current {@code BeanFactory} that the
|
* @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)
|
* 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
|
@Nullable
|
||||||
public String getBeanName() {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
package org.springframework.beans.factory.support;
|
package org.springframework.beans.factory.support;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.springframework.beans.BeanMetadataElement;
|
import org.springframework.beans.BeanMetadataElement;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
@ -107,13 +108,13 @@ public abstract class MethodOverride implements BeanMetadataElement {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object other) {
|
public boolean equals(@Nullable Object other) {
|
||||||
return (this == other || (other instanceof MethodOverride that &&
|
return (this == other || (other instanceof MethodOverride that &&
|
||||||
ObjectUtils.nullSafeEquals(this.methodName, that.methodName) &&
|
this.methodName.equals(that.methodName) &&
|
||||||
ObjectUtils.nullSafeEquals(this.source, that.source)));
|
ObjectUtils.nullSafeEquals(this.source, that.source)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of {@link MethodOverride} that represents an arbitrary
|
* Extension of {@link MethodOverride} that represents an arbitrary
|
||||||
|
@ -97,22 +97,19 @@ public class ReplaceOverride extends MethodOverride {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object other) {
|
public boolean equals(@Nullable Object other) {
|
||||||
return (other instanceof ReplaceOverride that && super.equals(other) &&
|
return (other instanceof ReplaceOverride that && super.equals(that) &&
|
||||||
ObjectUtils.nullSafeEquals(this.methodReplacerBeanName, that.methodReplacerBeanName) &&
|
this.methodReplacerBeanName.equals(that.methodReplacerBeanName) &&
|
||||||
ObjectUtils.nullSafeEquals(this.typeIdentifiers, that.typeIdentifiers));
|
this.typeIdentifiers.equals(that.typeIdentifiers));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hashCode = super.hashCode();
|
return Objects.hash(this.methodReplacerBeanName, this.typeIdentifiers);
|
||||||
hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(this.methodReplacerBeanName);
|
|
||||||
hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(this.typeIdentifiers);
|
|
||||||
return hashCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Replace override for method '" + getMethodName() + "'";
|
return "ReplaceOverride for method '" + getMethodName() + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue