Skip to content

Commit 206655c

Browse files
committed
Polishing
1 parent 1ae3eba commit 206655c

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.springframework.beans.BeanInstantiationException;
2626
import org.springframework.beans.BeanUtils;
2727
import org.springframework.beans.factory.BeanFactory;
28+
2829
import org.springframework.cglib.core.SpringNamingPolicy;
2930
import org.springframework.cglib.proxy.Callback;
3031
import org.springframework.cglib.proxy.CallbackFilter;
@@ -146,7 +147,7 @@ private Class<?> createEnhancedSubclass(RootBeanDefinition beanDefinition) {
146147
Enhancer enhancer = new Enhancer();
147148
enhancer.setSuperclass(beanDefinition.getBeanClass());
148149
enhancer.setNamingPolicy(SpringNamingPolicy.INSTANCE);
149-
enhancer.setCallbackFilter(new CallbackFilterImpl(beanDefinition));
150+
enhancer.setCallbackFilter(new MethodOverrideCallbackFilter(beanDefinition));
150151
enhancer.setCallbackTypes(CALLBACK_TYPES);
151152
return enhancer.createClass();
152153
}
@@ -166,34 +167,31 @@ private static class CglibIdentitySupport {
166167
this.beanDefinition = beanDefinition;
167168
}
168169

169-
/**
170-
* Exposed for equals method to allow access to enclosing class field
171-
*/
172-
protected RootBeanDefinition getBeanDefinition() {
173-
return beanDefinition;
170+
RootBeanDefinition getBeanDefinition() {
171+
return this.beanDefinition;
174172
}
175173

176174
@Override
177175
public boolean equals(Object other) {
178-
return (other.getClass().equals(getClass()) && ((CglibIdentitySupport) other).getBeanDefinition().equals(
179-
beanDefinition));
176+
return other.getClass().equals(this.getClass())
177+
&& ((CglibIdentitySupport) other).getBeanDefinition().equals(this.getBeanDefinition());
180178
}
181179

182180
@Override
183181
public int hashCode() {
184-
return beanDefinition.hashCode();
182+
return this.beanDefinition.hashCode();
185183
}
186184
}
187185

188186
/**
189-
* CGLIB object to filter method interception behavior.
187+
* CGLIB callback for filtering method interception behavior.
190188
*/
191-
private static class CallbackFilterImpl extends CglibIdentitySupport implements CallbackFilter {
189+
private static class MethodOverrideCallbackFilter extends CglibIdentitySupport implements CallbackFilter {
192190

193-
private static final Log logger = LogFactory.getLog(CallbackFilterImpl.class);
191+
private static final Log logger = LogFactory.getLog(MethodOverrideCallbackFilter.class);
194192

195193

196-
CallbackFilterImpl(RootBeanDefinition beanDefinition) {
194+
MethodOverrideCallbackFilter(RootBeanDefinition beanDefinition) {
197195
super(beanDefinition);
198196
}
199197

0 commit comments

Comments
 (0)