Polishing
This commit is contained in:
parent
450dbb2810
commit
2cd23a79a3
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2013 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.
|
||||||
|
|
@ -39,9 +39,10 @@ import static org.springframework.context.annotation.MetadataUtils.*;
|
||||||
*/
|
*/
|
||||||
public class AnnotationScopeMetadataResolver implements ScopeMetadataResolver {
|
public class AnnotationScopeMetadataResolver implements ScopeMetadataResolver {
|
||||||
|
|
||||||
|
private final ScopedProxyMode defaultProxyMode;
|
||||||
|
|
||||||
protected Class<? extends Annotation> scopeAnnotationType = Scope.class;
|
protected Class<? extends Annotation> scopeAnnotationType = Scope.class;
|
||||||
|
|
||||||
private final ScopedProxyMode defaultProxyMode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance of the {@code AnnotationScopeMetadataResolver} class.
|
* Create a new instance of the {@code AnnotationScopeMetadataResolver} class.
|
||||||
|
|
@ -77,8 +78,7 @@ public class AnnotationScopeMetadataResolver implements ScopeMetadataResolver {
|
||||||
ScopeMetadata metadata = new ScopeMetadata();
|
ScopeMetadata metadata = new ScopeMetadata();
|
||||||
if (definition instanceof AnnotatedBeanDefinition) {
|
if (definition instanceof AnnotatedBeanDefinition) {
|
||||||
AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition;
|
AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition;
|
||||||
AnnotationAttributes attributes =
|
AnnotationAttributes attributes = attributesFor(annDef.getMetadata(), this.scopeAnnotationType);
|
||||||
attributesFor(annDef.getMetadata(), this.scopeAnnotationType);
|
|
||||||
if (attributes != null) {
|
if (attributes != null) {
|
||||||
metadata.setScopeName(attributes.getString("value"));
|
metadata.setScopeName(attributes.getString("value"));
|
||||||
ScopedProxyMode proxyMode = attributes.getEnum("proxyMode");
|
ScopedProxyMode proxyMode = attributes.getEnum("proxyMode");
|
||||||
|
|
|
||||||
|
|
@ -205,18 +205,14 @@ public class ClassPathResource extends AbstractFileResolvingResource {
|
||||||
*/
|
*/
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
StringBuilder builder = new StringBuilder("class path resource [");
|
StringBuilder builder = new StringBuilder("class path resource [");
|
||||||
|
|
||||||
String pathToUse = path;
|
String pathToUse = path;
|
||||||
|
|
||||||
if (this.clazz != null && !pathToUse.startsWith("/")) {
|
if (this.clazz != null && !pathToUse.startsWith("/")) {
|
||||||
builder.append(ClassUtils.classPackageAsResourcePath(this.clazz));
|
builder.append(ClassUtils.classPackageAsResourcePath(this.clazz));
|
||||||
builder.append('/');
|
builder.append('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pathToUse.startsWith("/")) {
|
if (pathToUse.startsWith("/")) {
|
||||||
pathToUse = pathToUse.substring(1);
|
pathToUse = pathToUse.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append(pathToUse);
|
builder.append(pathToUse);
|
||||||
builder.append(']');
|
builder.append(']');
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
|
@ -232,9 +228,9 @@ public class ClassPathResource extends AbstractFileResolvingResource {
|
||||||
}
|
}
|
||||||
if (obj instanceof ClassPathResource) {
|
if (obj instanceof ClassPathResource) {
|
||||||
ClassPathResource otherRes = (ClassPathResource) obj;
|
ClassPathResource otherRes = (ClassPathResource) obj;
|
||||||
return (this.path.equals(otherRes.path)
|
return (this.path.equals(otherRes.path) &&
|
||||||
&& ObjectUtils.nullSafeEquals(this.classLoader, otherRes.classLoader) && ObjectUtils.nullSafeEquals(
|
ObjectUtils.nullSafeEquals(this.classLoader, otherRes.classLoader) &&
|
||||||
this.clazz, otherRes.clazz));
|
ObjectUtils.nullSafeEquals(this.clazz, otherRes.clazz));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue