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
59552319
Commit
59552319
authored
Nov 06, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15103 from dreis2211
* pr/15103: Polish some Map operations
parents
804f647a
3e95af2c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
11 deletions
+10
-11
HealthStatusHttpMapper.java
...framework/boot/actuate/health/HealthStatusHttpMapper.java
+4
-4
SessionsEndpoint.java
...pringframework/boot/actuate/session/SessionsEndpoint.java
+1
-2
PersistenceExceptionTranslationAutoConfigurationTests.java
...ersistenceExceptionTranslationAutoConfigurationTests.java
+2
-2
JavaBeanBinder.java
...ramework/boot/context/properties/bind/JavaBeanBinder.java
+2
-2
MapBinderTests.java
...ramework/boot/context/properties/bind/MapBinderTests.java
+1
-1
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java
View file @
59552319
/*
/*
* 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.
...
@@ -102,9 +102,9 @@ public class HealthStatusHttpMapper {
...
@@ -102,9 +102,9 @@ public class HealthStatusHttpMapper {
public
int
mapStatus
(
Status
status
)
{
public
int
mapStatus
(
Status
status
)
{
String
code
=
getUniformValue
(
status
.
getCode
());
String
code
=
getUniformValue
(
status
.
getCode
());
if
(
code
!=
null
)
{
if
(
code
!=
null
)
{
return
this
.
statusMapping
.
ke
ySet
().
stream
()
return
this
.
statusMapping
.
entr
ySet
().
stream
()
.
filter
((
key
)
->
code
.
equals
(
getUniformValue
(
key
)))
.
filter
((
entry
)
->
code
.
equals
(
getUniformValue
(
entry
.
getKey
()
)))
.
map
(
this
.
statusMapping
::
get
).
findFirst
()
.
map
(
Map
.
Entry
::
getValue
).
findFirst
()
.
orElse
(
WebEndpointResponse
.
STATUS_OK
);
.
orElse
(
WebEndpointResponse
.
STATUS_OK
);
}
}
return
WebEndpointResponse
.
STATUS_OK
;
return
WebEndpointResponse
.
STATUS_OK
;
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/session/SessionsEndpoint.java
View file @
59552319
...
@@ -79,8 +79,7 @@ public class SessionsEndpoint {
...
@@ -79,8 +79,7 @@ public class SessionsEndpoint {
private
final
List
<
SessionDescriptor
>
sessions
;
private
final
List
<
SessionDescriptor
>
sessions
;
public
SessionsReport
(
Map
<
String
,
?
extends
Session
>
sessions
)
{
public
SessionsReport
(
Map
<
String
,
?
extends
Session
>
sessions
)
{
this
.
sessions
=
sessions
.
entrySet
().
stream
()
this
.
sessions
=
sessions
.
values
().
stream
().
map
(
SessionDescriptor:
:
new
)
.
map
((
s
)
->
new
SessionDescriptor
(
s
.
getValue
()))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfigurationTests.java
View file @
59552319
/*
/*
* 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.
...
@@ -85,7 +85,7 @@ public class PersistenceExceptionTranslationAutoConfigurationTests {
...
@@ -85,7 +85,7 @@ public class PersistenceExceptionTranslationAutoConfigurationTests {
this
.
context
.
refresh
();
this
.
context
.
refresh
();
Map
<
String
,
PersistenceExceptionTranslationPostProcessor
>
beans
=
this
.
context
Map
<
String
,
PersistenceExceptionTranslationPostProcessor
>
beans
=
this
.
context
.
getBeansOfType
(
PersistenceExceptionTranslationPostProcessor
.
class
);
.
getBeansOfType
(
PersistenceExceptionTranslationPostProcessor
.
class
);
assertThat
(
beans
.
entrySet
()
).
isEmpty
();
assertThat
(
beans
).
isEmpty
();
}
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
@Test
(
expected
=
IllegalArgumentException
.
class
)
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java
View file @
59552319
...
@@ -68,8 +68,8 @@ class JavaBeanBinder implements BeanBinder {
...
@@ -68,8 +68,8 @@ class JavaBeanBinder implements BeanBinder {
private
<
T
>
boolean
bind
(
BeanPropertyBinder
propertyBinder
,
Bean
<
T
>
bean
,
private
<
T
>
boolean
bind
(
BeanPropertyBinder
propertyBinder
,
Bean
<
T
>
bean
,
BeanSupplier
<
T
>
beanSupplier
)
{
BeanSupplier
<
T
>
beanSupplier
)
{
boolean
bound
=
false
;
boolean
bound
=
false
;
for
(
Map
.
Entry
<
String
,
BeanProperty
>
entry
:
bean
.
getProperties
().
entrySet
())
{
for
(
BeanProperty
beanProperty
:
bean
.
getProperties
().
values
())
{
bound
|=
bind
(
beanSupplier
,
propertyBinder
,
entry
.
getValue
()
);
bound
|=
bind
(
beanSupplier
,
propertyBinder
,
beanProperty
);
}
}
return
bound
;
return
bound
;
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java
View file @
59552319
...
@@ -620,7 +620,7 @@ public class MapBinderTests {
...
@@ -620,7 +620,7 @@ public class MapBinderTests {
.
withExistingValue
(
Collections
.
singletonMap
(
"a"
,
"b"
)))
.
withExistingValue
(
Collections
.
singletonMap
(
"a"
,
"b"
)))
.
get
();
.
get
();
assertThat
(
result
).
hasSize
(
3
);
assertThat
(
result
).
hasSize
(
3
);
assertThat
(
result
.
entrySet
()
).
containsExactly
(
entry
(
"a"
,
"b"
),
entry
(
"c"
,
"d"
),
assertThat
(
result
).
containsExactly
(
entry
(
"a"
,
"b"
),
entry
(
"c"
,
"d"
),
entry
(
"e"
,
"f"
));
entry
(
"e"
,
"f"
));
}
}
...
...
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