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
638b4b81
Commit
638b4b81
authored
Jul 05, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename methods to make copying behaviour more clear
Closes gh-17441
parent
dde79e53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
RestTemplateBuilder.java
.../springframework/boot/web/client/RestTemplateBuilder.java
+12
-12
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
View file @
638b4b81
...
...
@@ -114,7 +114,7 @@ public class RestTemplateBuilder {
this
.
errorHandler
=
null
;
this
.
basicAuthentication
=
null
;
this
.
defaultHeaders
=
Collections
.
emptyMap
();
this
.
customizers
=
s
etOf
(
customizers
);
this
.
customizers
=
copiedS
etOf
(
customizers
);
this
.
requestCustomizers
=
Collections
.
emptySet
();
}
...
...
@@ -191,7 +191,7 @@ public class RestTemplateBuilder {
public
RestTemplateBuilder
messageConverters
(
Collection
<?
extends
HttpMessageConverter
<?>>
messageConverters
)
{
Assert
.
notNull
(
messageConverters
,
"MessageConverters must not be null"
);
return
new
RestTemplateBuilder
(
this
.
requestFactoryCustomizer
,
this
.
detectRequestFactory
,
this
.
rootUri
,
s
etOf
(
messageConverters
),
this
.
interceptors
,
this
.
requestFactory
,
this
.
uriTemplateHandler
,
copiedS
etOf
(
messageConverters
),
this
.
interceptors
,
this
.
requestFactory
,
this
.
uriTemplateHandler
,
this
.
errorHandler
,
this
.
basicAuthentication
,
this
.
defaultHeaders
,
this
.
customizers
,
this
.
requestCustomizers
);
}
...
...
@@ -235,7 +235,7 @@ public class RestTemplateBuilder {
*/
public
RestTemplateBuilder
defaultMessageConverters
()
{
return
new
RestTemplateBuilder
(
this
.
requestFactoryCustomizer
,
this
.
detectRequestFactory
,
this
.
rootUri
,
s
etOf
(
new
RestTemplate
().
getMessageConverters
()),
this
.
interceptors
,
this
.
requestFactory
,
copiedS
etOf
(
new
RestTemplate
().
getMessageConverters
()),
this
.
interceptors
,
this
.
requestFactory
,
this
.
uriTemplateHandler
,
this
.
errorHandler
,
this
.
basicAuthentication
,
this
.
defaultHeaders
,
this
.
customizers
,
this
.
requestCustomizers
);
}
...
...
@@ -266,7 +266,7 @@ public class RestTemplateBuilder {
public
RestTemplateBuilder
interceptors
(
Collection
<
ClientHttpRequestInterceptor
>
interceptors
)
{
Assert
.
notNull
(
interceptors
,
"interceptors must not be null"
);
return
new
RestTemplateBuilder
(
this
.
requestFactoryCustomizer
,
this
.
detectRequestFactory
,
this
.
rootUri
,
this
.
messageConverters
,
s
etOf
(
interceptors
),
this
.
requestFactory
,
this
.
uriTemplateHandler
,
this
.
messageConverters
,
copiedS
etOf
(
interceptors
),
this
.
requestFactory
,
this
.
uriTemplateHandler
,
this
.
errorHandler
,
this
.
basicAuthentication
,
this
.
defaultHeaders
,
this
.
customizers
,
this
.
requestCustomizers
);
}
...
...
@@ -477,7 +477,7 @@ public class RestTemplateBuilder {
Assert
.
notNull
(
customizers
,
"Customizers must not be null"
);
return
new
RestTemplateBuilder
(
this
.
requestFactoryCustomizer
,
this
.
detectRequestFactory
,
this
.
rootUri
,
this
.
messageConverters
,
this
.
interceptors
,
this
.
requestFactory
,
this
.
uriTemplateHandler
,
this
.
errorHandler
,
this
.
basicAuthentication
,
this
.
defaultHeaders
,
s
etOf
(
customizers
),
this
.
errorHandler
,
this
.
basicAuthentication
,
this
.
defaultHeaders
,
copiedS
etOf
(
customizers
),
this
.
requestCustomizers
);
}
...
...
@@ -541,7 +541,7 @@ public class RestTemplateBuilder {
return
new
RestTemplateBuilder
(
this
.
requestFactoryCustomizer
,
this
.
detectRequestFactory
,
this
.
rootUri
,
this
.
messageConverters
,
this
.
interceptors
,
this
.
requestFactory
,
this
.
uriTemplateHandler
,
this
.
errorHandler
,
this
.
basicAuthentication
,
this
.
defaultHeaders
,
this
.
customizers
,
s
etOf
(
requestCustomizers
));
copiedS
etOf
(
requestCustomizers
));
}
/**
...
...
@@ -677,16 +677,16 @@ public class RestTemplateBuilder {
}
@SuppressWarnings
(
"unchecked"
)
private
<
T
>
Set
<
T
>
s
etOf
(
T
...
items
)
{
return
s
etOf
(
Arrays
.
asList
(
items
));
private
<
T
>
Set
<
T
>
copiedS
etOf
(
T
...
items
)
{
return
copiedS
etOf
(
Arrays
.
asList
(
items
));
}
private
<
T
>
Set
<
T
>
s
etOf
(
Collection
<?
extends
T
>
collection
)
{
private
<
T
>
Set
<
T
>
copiedS
etOf
(
Collection
<?
extends
T
>
collection
)
{
return
Collections
.
unmodifiableSet
(
new
LinkedHashSet
<>(
collection
));
}
private
static
<
T
>
List
<
T
>
l
istOf
(
T
[]
items
)
{
return
Collections
.
unmodifiableList
(
new
ArrayList
<>(
Arrays
.
asList
(
items
)));
private
static
<
T
>
List
<
T
>
copiedL
istOf
(
T
[]
items
)
{
return
Collections
.
unmodifiableList
(
Arrays
.
asList
(
Arrays
.
copyOf
(
items
,
items
.
length
)));
}
private
static
<
T
>
Set
<
T
>
append
(
Collection
<?
extends
T
>
collection
,
Collection
<?
extends
T
>
additions
)
{
...
...
@@ -700,7 +700,7 @@ public class RestTemplateBuilder {
private
static
<
K
,
V
>
Map
<
K
,
List
<
V
>>
append
(
Map
<
K
,
List
<
V
>>
map
,
K
key
,
V
[]
values
)
{
Map
<
K
,
List
<
V
>>
result
=
new
LinkedHashMap
<>((
map
!=
null
)
?
map
:
Collections
.
emptyMap
());
if
(
values
!=
null
)
{
result
.
put
(
key
,
l
istOf
(
values
));
result
.
put
(
key
,
copiedL
istOf
(
values
));
}
return
Collections
.
unmodifiableMap
(
result
);
}
...
...
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