Formatting

pull/7262/head
Phillip Webb 8 years ago
parent 49b244b121
commit 57d5a2ebc6

@ -96,8 +96,8 @@ class TypeUtils {
/** /**
* Return the qualified name of the specified element. * Return the qualified name of the specified element.
* @param element the element to handle * @param element the element to handle
* @return the fully qualified name of the element, suitable for a call * @return the fully qualified name of the element, suitable for a call to
* to {@link Class#forName(String)} * {@link Class#forName(String)}
*/ */
public String getQualifiedName(Element element) { public String getQualifiedName(Element element) {
if (element == null) { if (element == null) {
@ -106,19 +106,20 @@ class TypeUtils {
TypeElement enclosingElement = getEnclosingTypeElement(element.asType()); TypeElement enclosingElement = getEnclosingTypeElement(element.asType());
if (enclosingElement != null) { if (enclosingElement != null) {
return getQualifiedName(enclosingElement) + "$" return getQualifiedName(enclosingElement) + "$"
+ ((DeclaredType) element.asType()).asElement().getSimpleName().toString(); + ((DeclaredType) element.asType()).asElement().getSimpleName()
.toString();
} }
if (element instanceof TypeElement) { if (element instanceof TypeElement) {
return ((TypeElement) element).getQualifiedName().toString(); return ((TypeElement) element).getQualifiedName().toString();
} }
throw new IllegalStateException("Could not extract qualified name from " throw new IllegalStateException(
+ element); "Could not extract qualified name from " + element);
} }
/** /**
* Return the type of the specified {@link TypeMirror} including all its generic * Return the type of the specified {@link TypeMirror} including all its generic
* information. * information.
* @param type the type to handle * @param type the type to handle
* @return a representation of the type including all its generic information * @return a representation of the type including all its generic information
*/ */
public String getType(TypeMirror type) { public String getType(TypeMirror type) {

@ -374,8 +374,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertThat(metadata).has(Metadata.withGroup("generic.foo.bar.biz").ofType( assertThat(metadata).has(Metadata.withGroup("generic.foo.bar.biz").ofType(
"org.springframework.boot.configurationsample.specific.GenericConfig$Bar$Biz")); "org.springframework.boot.configurationsample.specific.GenericConfig$Bar$Biz"));
assertThat(metadata).has(Metadata.withProperty("generic.foo.name") assertThat(metadata).has(Metadata.withProperty("generic.foo.name")
.ofType(String.class) .ofType(String.class).fromSource(GenericConfig.Foo.class));
.fromSource(GenericConfig.Foo.class));
assertThat(metadata).has(Metadata.withProperty("generic.foo.string-to-bar") assertThat(metadata).has(Metadata.withProperty("generic.foo.string-to-bar")
.ofType("java.util.Map<java.lang.String,org.springframework.boot.configurationsample.specific.GenericConfig.Bar<java.lang.Integer>>") .ofType("java.util.Map<java.lang.String,org.springframework.boot.configurationsample.specific.GenericConfig.Bar<java.lang.Integer>>")
.fromSource(GenericConfig.Foo.class)); .fromSource(GenericConfig.Foo.class));
@ -383,11 +382,9 @@ public class ConfigurationMetadataAnnotationProcessorTests {
.ofType("java.util.Map<java.lang.String,java.lang.Integer>") .ofType("java.util.Map<java.lang.String,java.lang.Integer>")
.fromSource(GenericConfig.Foo.class)); .fromSource(GenericConfig.Foo.class));
assertThat(metadata).has(Metadata.withProperty("generic.foo.bar.name") assertThat(metadata).has(Metadata.withProperty("generic.foo.bar.name")
.ofType("java.lang.String") .ofType("java.lang.String").fromSource(GenericConfig.Bar.class));
.fromSource(GenericConfig.Bar.class));
assertThat(metadata).has(Metadata.withProperty("generic.foo.bar.biz.name") assertThat(metadata).has(Metadata.withProperty("generic.foo.bar.biz.name")
.ofType("java.lang.String") .ofType("java.lang.String").fromSource(GenericConfig.Bar.Biz.class));
.fromSource(GenericConfig.Bar.Biz.class));
assertThat(metadata.getItems()).hasSize(9); assertThat(metadata.getItems()).hasSize(9);
} }

Loading…
Cancel
Save