Polishing
This commit is contained in:
parent
199aa776c9
commit
44ec6e0037
|
@ -196,6 +196,20 @@ class ConfigurationClassParser {
|
|||
processConfigurationClass(new ConfigurationClass(metadata, beanName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate each {@link ConfigurationClass} object.
|
||||
* @see ConfigurationClass#validate
|
||||
*/
|
||||
public void validate() {
|
||||
for (ConfigurationClass configClass : this.configurationClasses.keySet()) {
|
||||
configClass.validate(this.problemReporter);
|
||||
}
|
||||
}
|
||||
|
||||
public Set<ConfigurationClass> getConfigurationClasses() {
|
||||
return this.configurationClasses.keySet();
|
||||
}
|
||||
|
||||
|
||||
protected void processConfigurationClass(ConfigurationClass configClass) throws IOException {
|
||||
if (this.conditionEvaluator.shouldSkip(configClass.getMetadata(), ConfigurationPhase.PARSE_CONFIGURATION)) {
|
||||
|
@ -389,6 +403,7 @@ class ConfigurationClassParser {
|
|||
return beanMethods;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process the given <code>@PropertySource</code> annotation metadata.
|
||||
* @param propertySource metadata for the <code>@PropertySource</code> annotation found
|
||||
|
@ -464,6 +479,7 @@ class ConfigurationClassParser {
|
|||
this.propertySourceNames.add(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns {@code @Import} class, considering all meta-annotations.
|
||||
*/
|
||||
|
@ -596,30 +612,15 @@ class ConfigurationClassParser {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate each {@link ConfigurationClass} object.
|
||||
* @see ConfigurationClass#validate
|
||||
*/
|
||||
public void validate() {
|
||||
for (ConfigurationClass configClass : this.configurationClasses.keySet()) {
|
||||
configClass.validate(this.problemReporter);
|
||||
}
|
||||
}
|
||||
|
||||
public Set<ConfigurationClass> getConfigurationClasses() {
|
||||
return this.configurationClasses.keySet();
|
||||
}
|
||||
|
||||
|
||||
ImportRegistry getImportRegistry() {
|
||||
return this.importStack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Factory method to obtain a {@link SourceClass} from a {@link ConfigurationClass}.
|
||||
*/
|
||||
public SourceClass asSourceClass(ConfigurationClass configurationClass) throws IOException {
|
||||
private SourceClass asSourceClass(ConfigurationClass configurationClass) throws IOException {
|
||||
AnnotationMetadata metadata = configurationClass.getMetadata();
|
||||
if (metadata instanceof StandardAnnotationMetadata) {
|
||||
return asSourceClass(((StandardAnnotationMetadata) metadata).getIntrospectedClass());
|
||||
|
@ -630,7 +631,7 @@ class ConfigurationClassParser {
|
|||
/**
|
||||
* Factory method to obtain a {@link SourceClass} from a {@link Class}.
|
||||
*/
|
||||
public SourceClass asSourceClass(Class<?> classType) throws IOException {
|
||||
SourceClass asSourceClass(Class<?> classType) throws IOException {
|
||||
try {
|
||||
// Sanity test that we can read annotations, if not fall back to ASM
|
||||
classType.getAnnotations();
|
||||
|
@ -645,8 +646,8 @@ class ConfigurationClassParser {
|
|||
/**
|
||||
* Factory method to obtain {@link SourceClass}s from class names.
|
||||
*/
|
||||
public Collection<SourceClass> asSourceClasses(String[] classNames) throws IOException {
|
||||
List<SourceClass> annotatedClasses = new ArrayList<>();
|
||||
private Collection<SourceClass> asSourceClasses(String[] classNames) throws IOException {
|
||||
List<SourceClass> annotatedClasses = new ArrayList<>(classNames.length);
|
||||
for (String className : classNames) {
|
||||
annotatedClasses.add(asSourceClass(className));
|
||||
}
|
||||
|
@ -656,7 +657,7 @@ class ConfigurationClassParser {
|
|||
/**
|
||||
* Factory method to obtain a {@link SourceClass} from a class name.
|
||||
*/
|
||||
public SourceClass asSourceClass(String className) throws IOException {
|
||||
SourceClass asSourceClass(String className) throws IOException {
|
||||
if (className.startsWith("java")) {
|
||||
// Never use ASM for core java types
|
||||
try {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -172,7 +172,7 @@ public class AnnotatedElementUtils {
|
|||
*/
|
||||
public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, String annotationName) {
|
||||
Assert.notNull(element, "AnnotatedElement must not be null");
|
||||
Assert.hasLength(annotationName, "annotationName must not be null or empty");
|
||||
Assert.hasLength(annotationName, "'annotationName' must not be null or empty");
|
||||
|
||||
return getMetaAnnotationTypes(element, AnnotationUtils.getAnnotation(element, annotationName));
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ public class AnnotatedElementUtils {
|
|||
*/
|
||||
public static boolean hasMetaAnnotationTypes(AnnotatedElement element, String annotationName) {
|
||||
Assert.notNull(element, "AnnotatedElement must not be null");
|
||||
Assert.hasLength(annotationName, "annotationName must not be null or empty");
|
||||
Assert.hasLength(annotationName, "'annotationName' must not be null or empty");
|
||||
|
||||
return hasMetaAnnotationTypes(element, null, annotationName);
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ public class AnnotatedElementUtils {
|
|||
*/
|
||||
public static boolean isAnnotated(AnnotatedElement element, String annotationName) {
|
||||
Assert.notNull(element, "AnnotatedElement must not be null");
|
||||
Assert.hasLength(annotationName, "annotationName must not be null or empty");
|
||||
Assert.hasLength(annotationName, "'annotationName' must not be null or empty");
|
||||
|
||||
return Boolean.TRUE.equals(searchWithGetSemantics(element, null, annotationName, alwaysTrueAnnotationProcessor));
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ public class AnnotatedElementUtils {
|
|||
public static AnnotationAttributes getMergedAnnotationAttributes(AnnotatedElement element,
|
||||
String annotationName, boolean classValuesAsString, boolean nestedAnnotationsAsMap) {
|
||||
|
||||
Assert.hasLength(annotationName, "annotationName must not be null or empty");
|
||||
Assert.hasLength(annotationName, "'annotationName' must not be null or empty");
|
||||
AnnotationAttributes attributes = searchWithGetSemantics(element, null, annotationName,
|
||||
new MergedAnnotationAttributesProcessor(classValuesAsString, nestedAnnotationsAsMap));
|
||||
AnnotationUtils.postProcessAnnotationAttributes(element, attributes, classValuesAsString, nestedAnnotationsAsMap);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -50,9 +50,9 @@ import org.springframework.http.HttpStatus;
|
|||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
* @see org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver
|
||||
* @see javax.servlet.http.HttpServletResponse#sendError(int, String)
|
||||
* @since 3.0
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
Loading…
Reference in New Issue