blob: 8d36be49a4dda4a1f1007915adc093e5be92c28d [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;
jcc3d4e14a2015-04-21 11:32:05 +08006
7/**
8 * Represents for 3rd-party private original flow.
9 */
10public final class FlowRuleExtPayLoad {
11 private final byte[] payLoad;
12
13 /**
14 * private constructor.
15 *
16 * @param payLoad private flow
17 */
18 private FlowRuleExtPayLoad(byte[] payLoad) {
19 this.payLoad = payLoad;
20 }
21
22 /**
23 * Creates a FlowRuleExtPayLoad.
24 *
Thomas Vachuskaca540c32015-04-22 21:24:19 -070025 * @param payLoad payload byte data
jcc3d4e14a2015-04-21 11:32:05 +080026 * @return FlowRuleExtPayLoad payLoad
27 */
28 public static FlowRuleExtPayLoad flowRuleExtPayLoad(byte[] payLoad) {
29 return new FlowRuleExtPayLoad(payLoad);
30 }
31
32 /**
33 * Returns private flow.
34 *
35 * @return payLoad private flow
36 */
37 public byte[] payLoad() {
38 return payLoad;
39 }
40
41 @Override
42 public int hashCode() {
Sho SHIMIZUc9d8d0a2015-09-09 14:09:26 -070043 return Arrays.hashCode(payLoad);
jcc3d4e14a2015-04-21 11:32:05 +080044 }
45
46 public int hash() {
Sho SHIMIZUc9d8d0a2015-09-09 14:09:26 -070047 return Arrays.hashCode(payLoad);
jcc3d4e14a2015-04-21 11:32:05 +080048 }
49
50 @Override
51 public boolean equals(Object obj) {
52 if (this == obj) {
53 return true;
54 }
55 if (obj instanceof FlowRuleExtPayLoad) {
56 FlowRuleExtPayLoad that = (FlowRuleExtPayLoad) obj;
57 return Arrays.equals(payLoad, that.payLoad);
58
59 }
60 return false;
61 }
62
63 @Override
64 public String toString() {
65 return toStringHelper(this).add("payLoad", payLoad).toString();
66 }
67}