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
57d5a2eb
Commit
57d5a2eb
authored
Oct 31, 2016
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting
parent
49b244b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
TypeUtils.java
...pringframework/boot/configurationprocessor/TypeUtils.java
+7
-6
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+3
-6
No files found.
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java
View file @
57d5a2eb
...
...
@@ -96,8 +96,8 @@ class TypeUtils {
/**
* Return the qualified name of the specified element.
* @param element the element to handle
* @return the fully qualified name of the element, suitable for a call
*
to
{@link Class#forName(String)}
* @return the fully qualified name of the element, suitable for a call
to
* {@link Class#forName(String)}
*/
public
String
getQualifiedName
(
Element
element
)
{
if
(
element
==
null
)
{
...
...
@@ -106,19 +106,20 @@ class TypeUtils {
TypeElement
enclosingElement
=
getEnclosingTypeElement
(
element
.
asType
());
if
(
enclosingElement
!=
null
)
{
return
getQualifiedName
(
enclosingElement
)
+
"$"
+
((
DeclaredType
)
element
.
asType
()).
asElement
().
getSimpleName
().
toString
();
+
((
DeclaredType
)
element
.
asType
()).
asElement
().
getSimpleName
()
.
toString
();
}
if
(
element
instanceof
TypeElement
)
{
return
((
TypeElement
)
element
).
getQualifiedName
().
toString
();
}
throw
new
IllegalStateException
(
"Could not extract qualified name from "
+
element
);
throw
new
IllegalStateException
(
"Could not extract qualified name from "
+
element
);
}
/**
* Return the type of the specified {@link TypeMirror} including all its generic
* information.
* @param type
the type to handle
* @param type the type to handle
* @return a representation of the type including all its generic information
*/
public
String
getType
(
TypeMirror
type
)
{
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
57d5a2eb
...
...
@@ -374,8 +374,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertThat
(
metadata
).
has
(
Metadata
.
withGroup
(
"generic.foo.bar.biz"
).
ofType
(
"org.springframework.boot.configurationsample.specific.GenericConfig$Bar$Biz"
));
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"generic.foo.name"
)
.
ofType
(
String
.
class
)
.
fromSource
(
GenericConfig
.
Foo
.
class
));
.
ofType
(
String
.
class
).
fromSource
(
GenericConfig
.
Foo
.
class
));
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>>"
)
.
fromSource
(
GenericConfig
.
Foo
.
class
));
...
...
@@ -383,11 +382,9 @@ public class ConfigurationMetadataAnnotationProcessorTests {
.
ofType
(
"java.util.Map<java.lang.String,java.lang.Integer>"
)
.
fromSource
(
GenericConfig
.
Foo
.
class
));
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"generic.foo.bar.name"
)
.
ofType
(
"java.lang.String"
)
.
fromSource
(
GenericConfig
.
Bar
.
class
));
.
ofType
(
"java.lang.String"
).
fromSource
(
GenericConfig
.
Bar
.
class
));
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"generic.foo.bar.biz.name"
)
.
ofType
(
"java.lang.String"
)
.
fromSource
(
GenericConfig
.
Bar
.
Biz
.
class
));
.
ofType
(
"java.lang.String"
).
fromSource
(
GenericConfig
.
Bar
.
Biz
.
class
));
assertThat
(
metadata
.
getItems
()).
hasSize
(
9
);
}
...
...
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