blob: 4c8d22cba2e00b3192ac1ebf53714ab9fdaecbf8 [file] [log] [blame]
jcc3d4e14a2015-04-21 11:32:05 +08001package org.onosproject.net.flow;
2
3import static com.google.common.base.MoreObjects.toStringHelper;
4
5import java.util.Arrays;
6import java.util.Objects;
7
8/**
9 * Represents for 3rd-party private original flow.
10 */
11public 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 Vachuskaca540c32015-04-22 21:24:19 -070026 * @param payLoad payload byte data
jcc3d4e14a2015-04-21 11:32:05 +080027 * @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}