Reformat code following spring-javaformat upgrade
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 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.
|
||||
@@ -84,25 +84,25 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
|
||||
private void addConditionPropertyGenerators(List<PropertyGenerator> generators) {
|
||||
String annotationPackage = "org.springframework.boot.autoconfigure.condition";
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnClass")
|
||||
.withAnnotation(new OnClassConditionValueExtractor()));
|
||||
.withAnnotation(new OnClassConditionValueExtractor()));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnBean")
|
||||
.withAnnotation(new OnBeanConditionValueExtractor()));
|
||||
.withAnnotation(new OnBeanConditionValueExtractor()));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnSingleCandidate")
|
||||
.withAnnotation(new OnBeanConditionValueExtractor()));
|
||||
.withAnnotation(new OnBeanConditionValueExtractor()));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnWebApplication")
|
||||
.withAnnotation(ValueExtractor.allFrom("type")));
|
||||
.withAnnotation(ValueExtractor.allFrom("type")));
|
||||
}
|
||||
|
||||
private void addAutoConfigurePropertyGenerators(List<PropertyGenerator> generators) {
|
||||
String annotationPackage = "org.springframework.boot.autoconfigure";
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureBefore", true)
|
||||
.withAnnotation(ValueExtractor.allFrom("value", "name"))
|
||||
.withAnnotation("AutoConfiguration", ValueExtractor.allFrom("before", "beforeName")));
|
||||
.withAnnotation(ValueExtractor.allFrom("value", "name"))
|
||||
.withAnnotation("AutoConfiguration", ValueExtractor.allFrom("before", "beforeName")));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureAfter", true)
|
||||
.withAnnotation(ValueExtractor.allFrom("value", "name"))
|
||||
.withAnnotation("AutoConfiguration", ValueExtractor.allFrom("after", "afterName")));
|
||||
.withAnnotation(ValueExtractor.allFrom("value", "name"))
|
||||
.withAnnotation("AutoConfiguration", ValueExtractor.allFrom("after", "afterName")));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureOrder")
|
||||
.withAnnotation(ValueExtractor.allFrom("value")));
|
||||
.withAnnotation(ValueExtractor.allFrom("value")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -207,7 +207,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
|
||||
Object value = annotationValue.getValue();
|
||||
if (value instanceof List) {
|
||||
return ((List<AnnotationValue>) value).stream()
|
||||
.map((annotation) -> extractValue(annotation.getValue()));
|
||||
.map((annotation) -> extractValue(annotation.getValue()));
|
||||
}
|
||||
return Stream.of(extractValue(value));
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
|
||||
public List<Object> getValues(AnnotationMirror annotation) {
|
||||
Map<String, AnnotationValue> attributes = new LinkedHashMap<>();
|
||||
annotation.getElementValues()
|
||||
.forEach((key, value) -> attributes.put(key.getSimpleName().toString(), value));
|
||||
.forEach((key, value) -> attributes.put(key.getSimpleName().toString(), value));
|
||||
if (attributes.containsKey("name")) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -274,8 +274,9 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
|
||||
}
|
||||
|
||||
private int compare(Object o1, Object o2) {
|
||||
return Comparator.comparing(this::isSpringClass).thenComparing(String.CASE_INSENSITIVE_ORDER)
|
||||
.compare(o1.toString(), o2.toString());
|
||||
return Comparator.comparing(this::isSpringClass)
|
||||
.thenComparing(String.CASE_INSENSITIVE_ORDER)
|
||||
.compare(o1.toString(), o2.toString());
|
||||
}
|
||||
|
||||
private boolean isSpringClass(String type) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 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.
|
||||
@@ -57,7 +57,7 @@ class AutoConfigureAnnotationProcessorTests {
|
||||
+ "TestClassConfiguration$Nested,org.springframework.foo");
|
||||
assertThat(properties).containsKey("org.springframework.boot.autoconfigureprocessor.TestClassConfiguration");
|
||||
assertThat(properties)
|
||||
.containsKey("org.springframework.boot.autoconfigureprocessor.TestClassConfiguration$Nested");
|
||||
.containsKey("org.springframework.boot.autoconfigureprocessor.TestClassConfiguration$Nested");
|
||||
assertThat(properties).containsEntry(
|
||||
"org.springframework.boot.autoconfigureprocessor.TestClassConfiguration.ConditionalOnBean",
|
||||
"java.io.OutputStream");
|
||||
@@ -114,8 +114,8 @@ class AutoConfigureAnnotationProcessorTests {
|
||||
@Test
|
||||
void annotatedClassWithAutoConfiguration() throws Exception {
|
||||
Properties properties = compile(TestAutoConfigurationConfiguration.class);
|
||||
assertThat(properties).containsEntry(
|
||||
"org.springframework.boot.autoconfigureprocessor.TestAutoConfigurationConfiguration", "");
|
||||
assertThat(properties)
|
||||
.containsEntry("org.springframework.boot.autoconfigureprocessor.TestAutoConfigurationConfiguration", "");
|
||||
assertThat(properties).containsEntry(
|
||||
"org.springframework.boot.autoconfigureprocessor.TestAutoConfigurationConfiguration.AutoConfigureBefore",
|
||||
"java.io.InputStream,test.before1,test.before2");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 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.
|
||||
@@ -51,21 +51,21 @@ public class TestAutoConfigureAnnotationProcessor extends AutoConfigureAnnotatio
|
||||
List<PropertyGenerator> generators = new ArrayList<>();
|
||||
String annotationPackage = "org.springframework.boot.autoconfigureprocessor";
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnClass")
|
||||
.withAnnotation("TestConditionalOnClass", new OnClassConditionValueExtractor()));
|
||||
.withAnnotation("TestConditionalOnClass", new OnClassConditionValueExtractor()));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnBean")
|
||||
.withAnnotation("TestConditionalOnBean", new OnBeanConditionValueExtractor()));
|
||||
.withAnnotation("TestConditionalOnBean", new OnBeanConditionValueExtractor()));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnSingleCandidate")
|
||||
.withAnnotation("TestConditionalOnSingleCandidate", new OnBeanConditionValueExtractor()));
|
||||
.withAnnotation("TestConditionalOnSingleCandidate", new OnBeanConditionValueExtractor()));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnWebApplication")
|
||||
.withAnnotation("TestConditionalOnWebApplication", ValueExtractor.allFrom("type")));
|
||||
.withAnnotation("TestConditionalOnWebApplication", ValueExtractor.allFrom("type")));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureBefore", true)
|
||||
.withAnnotation("TestAutoConfigureBefore", ValueExtractor.allFrom("value", "name"))
|
||||
.withAnnotation("TestAutoConfiguration", ValueExtractor.allFrom("before", "beforeName")));
|
||||
.withAnnotation("TestAutoConfigureBefore", ValueExtractor.allFrom("value", "name"))
|
||||
.withAnnotation("TestAutoConfiguration", ValueExtractor.allFrom("before", "beforeName")));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureAfter", true)
|
||||
.withAnnotation("TestAutoConfigureAfter", ValueExtractor.allFrom("value", "name"))
|
||||
.withAnnotation("TestAutoConfiguration", ValueExtractor.allFrom("after", "afterName")));
|
||||
.withAnnotation("TestAutoConfigureAfter", ValueExtractor.allFrom("value", "name"))
|
||||
.withAnnotation("TestAutoConfiguration", ValueExtractor.allFrom("after", "afterName")));
|
||||
generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureOrder")
|
||||
.withAnnotation("TestAutoConfigureOrder", ValueExtractor.allFrom("value")));
|
||||
.withAnnotation("TestAutoConfigureOrder", ValueExtractor.allFrom("value")));
|
||||
return generators;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user