jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 1 | package org.onosproject.net.flow; |
| 2 | |
| 3 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 4 | |
| 5 | import java.util.Arrays; |
| 6 | import java.util.Objects; |
| 7 | |
| 8 | /** |
| 9 | * Represents for 3rd-party private original flow. |
| 10 | */ |
| 11 | public final class FlowRuleExtPayLoad { |
| 12 | private final byte[] payLoad; |
| 13 | |
| 14 | /** |
| 15 | * private constructor. |
| 16 | * |
| 17 | * @param payLoad private flow |
| 18 | */ |
| 19 | private FlowRuleExtPayLoad(byte[] payLoad) { |
| 20 | this.payLoad = payLoad; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Creates a FlowRuleExtPayLoad. |
| 25 | * |
Thomas Vachuska | ca540c3 | 2015-04-22 21:24:19 -0700 | [diff] [blame] | 26 | * @param payLoad payload byte data |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 27 | * @return FlowRuleExtPayLoad payLoad |
| 28 | */ |
| 29 | public static FlowRuleExtPayLoad flowRuleExtPayLoad(byte[] payLoad) { |
| 30 | return new FlowRuleExtPayLoad(payLoad); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Returns private flow. |
| 35 | * |
| 36 | * @return payLoad private flow |
| 37 | */ |
| 38 | public byte[] payLoad() { |
| 39 | return payLoad; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public int hashCode() { |
| 44 | return Objects.hash(payLoad); |
| 45 | } |
| 46 | |
| 47 | public int hash() { |
| 48 | return Objects.hash(payLoad); |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | public boolean equals(Object obj) { |
| 53 | if (this == obj) { |
| 54 | return true; |
| 55 | } |
| 56 | if (obj instanceof FlowRuleExtPayLoad) { |
| 57 | FlowRuleExtPayLoad that = (FlowRuleExtPayLoad) obj; |
| 58 | return Arrays.equals(payLoad, that.payLoad); |
| 59 | |
| 60 | } |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public String toString() { |
| 66 | return toStringHelper(this).add("payLoad", payLoad).toString(); |
| 67 | } |
| 68 | } |