Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
60f5cf10
Commit
60f5cf10
authored
Jan 18, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
849baa4c
927c2cac
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
TypeUtils.java
...pringframework/boot/configurationprocessor/TypeUtils.java
+10
-1
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+2
-0
SimpleCollectionProperties.java
...onfigurationsample/simple/SimpleCollectionProperties.java
+17
-1
No files found.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java
View file @
60f5cf10
...
@@ -19,7 +19,9 @@ package org.springframework.boot.configurationprocessor;
...
@@ -19,7 +19,9 @@ package org.springframework.boot.configurationprocessor;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
javax.annotation.processing.ProcessingEnvironment
;
import
javax.annotation.processing.ProcessingEnvironment
;
import
javax.lang.model.element.Element
;
import
javax.lang.model.element.Element
;
...
@@ -185,7 +187,14 @@ class TypeUtils {
...
@@ -185,7 +187,14 @@ class TypeUtils {
return
getQualifiedName
(
enclosingElement
)
+
"$"
return
getQualifiedName
(
enclosingElement
)
+
"$"
+
type
.
asElement
().
getSimpleName
().
toString
();
+
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
@Override
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
60f5cf10
...
@@ -267,6 +267,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
...
@@ -267,6 +267,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
"java.util.Collection<java.lang.Byte>"
));
"java.util.Collection<java.lang.Byte>"
));
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"collection.doubles"
,
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"collection.doubles"
,
"java.util.List<java.lang.Double>"
));
"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
@Test
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/SimpleCollectionProperties.java
View file @
60f5cf10
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
@@ -45,6 +45,8 @@ public class SimpleCollectionProperties {
...
@@ -45,6 +45,8 @@ public class SimpleCollectionProperties {
private
final
List
<
Double
>
doubles
=
new
ArrayList
<>();
private
final
List
<
Double
>
doubles
=
new
ArrayList
<>();
private
final
Map
<
String
,
Holder
<
String
>>
namesToHolders
=
new
HashMap
<>();
public
Map
<
Integer
,
String
>
getIntegersToNames
()
{
public
Map
<
Integer
,
String
>
getIntegersToNames
()
{
return
this
.
integersToNames
;
return
this
.
integersToNames
;
}
}
...
@@ -81,4 +83,18 @@ public class SimpleCollectionProperties {
...
@@ -81,4 +83,18 @@ public class SimpleCollectionProperties {
return
this
.
doubles
;
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
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment