|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2020 the original author or authors. |
| 2 | + * Copyright 2002-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -194,15 +194,15 @@ public boolean equals(@Nullable Object other) {
|
194 | 194 | return false;
|
195 | 195 | }
|
196 | 196 | RequestEntity<?> otherEntity = (RequestEntity<?>) other;
|
197 |
| - return (ObjectUtils.nullSafeEquals(getMethod(), otherEntity.getMethod()) && |
198 |
| - ObjectUtils.nullSafeEquals(getUrl(), otherEntity.getUrl())); |
| 197 | + return (ObjectUtils.nullSafeEquals(this.method, otherEntity.method) && |
| 198 | + ObjectUtils.nullSafeEquals(this.url, otherEntity.url)); |
199 | 199 | }
|
200 | 200 |
|
201 | 201 | @Override
|
202 | 202 | public int hashCode() {
|
203 | 203 | int hashCode = super.hashCode();
|
204 | 204 | hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(this.method);
|
205 |
| - hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(getUrl()); |
| 205 | + hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(this.url); |
206 | 206 | return hashCode;
|
207 | 207 | }
|
208 | 208 |
|
@@ -544,13 +544,13 @@ private static class DefaultBodyBuilder implements BodyBuilder {
|
544 | 544 | private final URI uri;
|
545 | 545 |
|
546 | 546 | @Nullable
|
547 |
| - String uriTemplate; |
| 547 | + private final String uriTemplate; |
548 | 548 |
|
549 | 549 | @Nullable
|
550 |
| - private Object[] uriVarsArray; |
| 550 | + private final Object[] uriVarsArray; |
551 | 551 |
|
552 | 552 | @Nullable
|
553 |
| - Map<String, ?> uriVarsMap; |
| 553 | + private final Map<String, ?> uriVarsMap; |
554 | 554 |
|
555 | 555 | DefaultBodyBuilder(HttpMethod method, URI url) {
|
556 | 556 | this.method = method;
|
@@ -661,7 +661,7 @@ public <T> RequestEntity<T> body(T body, Type type) {
|
661 | 661 | return buildInternal(body, type);
|
662 | 662 | }
|
663 | 663 |
|
664 |
| - private <T> RequestEntity<T> buildInternal(@Nullable T body, @Nullable Type type) { |
| 664 | + private <T> RequestEntity<T> buildInternal(@Nullable T body, @Nullable Type type) { |
665 | 665 | if (this.uri != null) {
|
666 | 666 | return new RequestEntity<>(body, this.headers, this.method, this.uri, type);
|
667 | 667 | }
|
@@ -716,6 +716,25 @@ public Object[] getVars() {
|
716 | 716 | return this.uriVarsMap;
|
717 | 717 | }
|
718 | 718 |
|
| 719 | + @Override |
| 720 | + public boolean equals(@Nullable Object other) { |
| 721 | + if (this == other) { |
| 722 | + return true; |
| 723 | + } |
| 724 | + if (!super.equals(other)) { |
| 725 | + return false; |
| 726 | + } |
| 727 | + UriTemplateRequestEntity<?> otherEntity = (UriTemplateRequestEntity<?>) other; |
| 728 | + return (ObjectUtils.nullSafeEquals(this.uriTemplate, otherEntity.uriTemplate) && |
| 729 | + ObjectUtils.nullSafeEquals(this.uriVarsArray, otherEntity.uriVarsArray) && |
| 730 | + ObjectUtils.nullSafeEquals(this.uriVarsMap, otherEntity.uriVarsMap)); |
| 731 | + } |
| 732 | + |
| 733 | + @Override |
| 734 | + public int hashCode() { |
| 735 | + return (29 * super.hashCode() + ObjectUtils.nullSafeHashCode(this.uriTemplate)); |
| 736 | + } |
| 737 | + |
719 | 738 | @Override
|
720 | 739 | public String toString() {
|
721 | 740 | return format(getMethod(), getUriTemplate(), getBody(), getHeaders());
|
|
0 commit comments