Committed by
Ray Milkey
[ONOS-3116] PortPairid modification
Change-Id: Ic057169cd549098f57e7a5e1c68cc2142636269b
Showing
1 changed file
with
8 additions
and
14 deletions
... | @@ -16,11 +16,9 @@ | ... | @@ -16,11 +16,9 @@ |
16 | package org.onosproject.vtnrsc; | 16 | package org.onosproject.vtnrsc; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | 19 | ||
21 | import java.util.UUID; | 20 | import java.util.UUID; |
22 | - | 21 | +import java.util.Objects; |
23 | -import com.google.common.base.Objects; | ||
24 | 22 | ||
25 | /** | 23 | /** |
26 | * Representation of a Port Pair ID. | 24 | * Representation of a Port Pair ID. |
... | @@ -34,8 +32,7 @@ public final class PortPairId { | ... | @@ -34,8 +32,7 @@ public final class PortPairId { |
34 | * | 32 | * |
35 | * @param id UUID id of port pair | 33 | * @param id UUID id of port pair |
36 | */ | 34 | */ |
37 | - private PortPairId(UUID id) { | 35 | + private PortPairId(final UUID id) { |
38 | - checkNotNull(id, "Port chain id can not be null"); | ||
39 | this.portPairId = id; | 36 | this.portPairId = id; |
40 | } | 37 | } |
41 | 38 | ||
... | @@ -45,7 +42,7 @@ public final class PortPairId { | ... | @@ -45,7 +42,7 @@ public final class PortPairId { |
45 | * @param id UUID of port pair id | 42 | * @param id UUID of port pair id |
46 | * @return object of port pair id | 43 | * @return object of port pair id |
47 | */ | 44 | */ |
48 | - public static PortPairId portPairId(UUID id) { | 45 | + public static PortPairId portPairId(final UUID id) { |
49 | return new PortPairId(id); | 46 | return new PortPairId(id); |
50 | } | 47 | } |
51 | 48 | ||
... | @@ -55,7 +52,7 @@ public final class PortPairId { | ... | @@ -55,7 +52,7 @@ public final class PortPairId { |
55 | * @param id port pair id in string | 52 | * @param id port pair id in string |
56 | * @return object of port pair id | 53 | * @return object of port pair id |
57 | */ | 54 | */ |
58 | - public static PortPairId portPairId(String id) { | 55 | + public static PortPairId portPairId(final String id) { |
59 | return new PortPairId(UUID.fromString(id)); | 56 | return new PortPairId(UUID.fromString(id)); |
60 | } | 57 | } |
61 | 58 | ||
... | @@ -73,10 +70,9 @@ public final class PortPairId { | ... | @@ -73,10 +70,9 @@ public final class PortPairId { |
73 | if (this == obj) { | 70 | if (this == obj) { |
74 | return true; | 71 | return true; |
75 | } | 72 | } |
76 | - | 73 | + if (obj instanceof PortPairId) { |
77 | - if (obj.getClass() == this.getClass()) { | 74 | + final PortPairId other = (PortPairId) obj; |
78 | - PortPairId that = (PortPairId) obj; | 75 | + return Objects.equals(this.portPairId, other.portPairId); |
79 | - return Objects.equal(this.portPairId, that.portPairId); | ||
80 | } | 76 | } |
81 | return false; | 77 | return false; |
82 | } | 78 | } |
... | @@ -88,8 +84,6 @@ public final class PortPairId { | ... | @@ -88,8 +84,6 @@ public final class PortPairId { |
88 | 84 | ||
89 | @Override | 85 | @Override |
90 | public String toString() { | 86 | public String toString() { |
91 | - return toStringHelper(this) | 87 | + return toStringHelper(this).add("portPairId", portPairId.toString()).toString(); |
92 | - .add("portPairId", portPairId.toString()) | ||
93 | - .toString(); | ||
94 | } | 88 | } |
95 | } | 89 | } | ... | ... |
-
Please register or login to post a comment