Merge branch '1.5.x'
This commit is contained in:
commit
60f5cf10ba
|
@ -19,7 +19,9 @@ package org.springframework.boot.configurationprocessor;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
import javax.lang.model.element.Element;
|
||||
|
@ -185,7 +187,14 @@ class TypeUtils {
|
|||
return getQualifiedName(enclosingElement) + "$"
|
||||
+ type.asElement().getSimpleName().toString();
|
||||
}
|
||||
return type.toString();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getQualifiedName(type.asElement()));
|
||||
if (!type.getTypeArguments().isEmpty()) {
|
||||
List<String> parameters = type.getTypeArguments().stream()
|
||||
.map(TypeMirror::toString).collect(Collectors.toList());
|
||||
sb.append("<").append(String.join(",", parameters)).append(">");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -267,6 +267,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
|||
"java.util.Collection<java.lang.Byte>"));
|
||||
assertThat(metadata).has(Metadata.withProperty("collection.doubles",
|
||||
"java.util.List<java.lang.Double>"));
|
||||
assertThat(metadata).has(Metadata.withProperty("collection.names-to-holders",
|
||||
"java.util.Map<java.lang.String,org.springframework.boot.configurationsample.simple.SimpleCollectionProperties.Holder<java.lang.String>>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
@ -45,6 +45,8 @@ public class SimpleCollectionProperties {
|
|||
|
||||
private final List<Double> doubles = new ArrayList<>();
|
||||
|
||||
private final Map<String, Holder<String>> namesToHolders = new HashMap<>();
|
||||
|
||||
public Map<Integer, String> getIntegersToNames() {
|
||||
return this.integersToNames;
|
||||
}
|
||||
|
@ -81,4 +83,18 @@ public class SimpleCollectionProperties {
|
|||
return this.doubles;
|
||||
}
|
||||
|
||||
public Map<String, Holder<String>> getNamesToHolders() {
|
||||
return this.namesToHolders;
|
||||
}
|
||||
|
||||
public static class Holder<T> {
|
||||
|
||||
private T target;
|
||||
|
||||
public void setTarget(T target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue