|
6 | 6 | import com.google.common.collect.ImmutableSet; |
7 | 7 |
|
8 | 8 | import java.io.InputStream; |
| 9 | +import java.util.Objects; |
9 | 10 | import java.util.Optional; |
10 | 11 | import java.util.Set; |
11 | | - |
12 | 12 | import javax.annotation.Nullable; |
13 | 13 | import javax.annotation.concurrent.Immutable; |
14 | 14 |
|
@@ -105,39 +105,25 @@ public boolean equals(@Nullable Object o) { |
105 | 105 |
|
106 | 106 | OperationDescription that = (OperationDescription) o; |
107 | 107 |
|
108 | | - if (name() != null ? !name().equals(that.name()) : that.name() != null) { |
109 | | - return false; |
110 | | - } |
111 | | - if (summary() != null ? !summary().equals(that.summary()) : that.summary() != null) { |
112 | | - return false; |
113 | | - } |
114 | | - if (category() != that.category()) { |
115 | | - return false; |
116 | | - } |
117 | | - if (icon() != null ? !icon().equals(that.icon()) : that.icon() != null) { |
118 | | - return false; |
119 | | - } |
120 | | - return aliases() != null ? aliases().equals(that.aliases()) : that.aliases() == null; |
121 | | - |
| 108 | + return Objects.equals(name, that.name) |
| 109 | + && Objects.equals(summary, that.summary) |
| 110 | + && Objects.equals(category, that.category) |
| 111 | + && Objects.equals(icon, that.icon) |
| 112 | + && Objects.equals(aliases, that.aliases); |
122 | 113 | } |
123 | 114 |
|
124 | 115 | @Override |
125 | 116 | public int hashCode() { |
126 | | - int result = name() != null ? name().hashCode() : 0; |
127 | | - result = 31 * result + (summary() != null ? summary().hashCode() : 0); |
128 | | - result = 31 * result + (category() != null ? category().hashCode() : 0); |
129 | | - result = 31 * result + (icon() != null ? icon().hashCode() : 0); |
130 | | - result = 31 * result + (aliases() != null ? aliases().hashCode() : 0); |
131 | | - return result; |
| 117 | + return Objects.hash(name, summary, category, icon, aliases); |
132 | 118 | } |
133 | 119 |
|
134 | 120 | @Override |
135 | 121 | public String toString() { |
136 | 122 | return MoreObjects.toStringHelper(this) |
137 | | - .add("name", name()) |
138 | | - .add("summary", summary()) |
139 | | - .add("aliases", aliases()) |
140 | | - .add("category", category()) |
| 123 | + .add("name", name) |
| 124 | + .add("summary", summary) |
| 125 | + .add("aliases", aliases) |
| 126 | + .add("category", category) |
141 | 127 | .toString(); |
142 | 128 | } |
143 | 129 |
|
|
0 commit comments