File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed
main/java/software/amazon/awssdk/core
test/java/software/amazon/awssdk/core Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "type" : " bugfix" ,
3
+ "category" : " AWS SDK for Java v2" ,
4
+ "contributor" : " brettkail-wk" ,
5
+ "description" : " Implement `ApiName.equals`/`.hashCode`"
6
+ }
Original file line number Diff line number Diff line change 17
17
18
18
import static software .amazon .awssdk .utils .Validate .notNull ;
19
19
20
+ import java .util .Objects ;
20
21
import software .amazon .awssdk .annotations .SdkPublicApi ;
21
22
22
23
/**
@@ -42,6 +43,30 @@ public String version() {
42
43
return version ;
43
44
}
44
45
46
+ @ Override
47
+ public boolean equals (Object o ) {
48
+ if (this == o ) {
49
+ return true ;
50
+ }
51
+ if (o == null || getClass () != o .getClass ()) {
52
+ return false ;
53
+ }
54
+
55
+ ApiName that = (ApiName ) o ;
56
+
57
+ if (!Objects .equals (name , that .name )) {
58
+ return false ;
59
+ }
60
+ return Objects .equals (version , that .version );
61
+ }
62
+
63
+ @ Override
64
+ public int hashCode () {
65
+ int result = name != null ? name .hashCode () : 0 ;
66
+ result = 31 * result + (version != null ? version .hashCode () : 0 );
67
+ return result ;
68
+ }
69
+
45
70
public static Builder builder () {
46
71
return new BuilderImpl ();
47
72
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License").
5
+ * You may not use this file except in compliance with the License.
6
+ * A copy of the License is located at
7
+ *
8
+ * http://aws.amazon.com/apache2.0
9
+ *
10
+ * or in the "license" file accompanying this file. This file is distributed
11
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
+ * express or implied. See the License for the specific language governing
13
+ * permissions and limitations under the License.
14
+ */
15
+
16
+ package software .amazon .awssdk .core ;
17
+
18
+ import nl .jqno .equalsverifier .EqualsVerifier ;
19
+ import org .junit .jupiter .api .Test ;
20
+
21
+ public class ApiNameTest {
22
+
23
+ @ Test
24
+ public void equalsHashCode () {
25
+ EqualsVerifier .forClass (ApiName .class )
26
+ .withNonnullFields ("name" , "version" )
27
+ .verify ();
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments