blob: d63f599ecd30bb53a9f3fccc6a9b1a1c3543d9ef [file] [log] [blame]
Thomas Vachuska58de4162015-09-10 16:15:33 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thomas Vachuska58de4162015-09-10 16:15:33 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
jcc3d4e14a2015-04-21 11:32:05 +080016package org.onosproject.net.flow;
17
jcc3d4e14a2015-04-21 11:32:05 +080018import java.util.Arrays;
jcc3d4e14a2015-04-21 11:32:05 +080019
Jonathan Hart2b3e22b2017-02-03 18:31:13 -080020import static com.google.common.base.MoreObjects.toStringHelper;
21
jcc3d4e14a2015-04-21 11:32:05 +080022/**
23 * Represents for 3rd-party private original flow.
Jonathan Hart2b3e22b2017-02-03 18:31:13 -080024 *
25 * @deprecated in Junco release
jcc3d4e14a2015-04-21 11:32:05 +080026 */
Jonathan Hart2b3e22b2017-02-03 18:31:13 -080027@Deprecated
jcc3d4e14a2015-04-21 11:32:05 +080028public final class FlowRuleExtPayLoad {
29 private final byte[] payLoad;
30
31 /**
32 * private constructor.
33 *
34 * @param payLoad private flow
35 */
36 private FlowRuleExtPayLoad(byte[] payLoad) {
37 this.payLoad = payLoad;
38 }
39
40 /**
41 * Creates a FlowRuleExtPayLoad.
42 *
Thomas Vachuskaca540c32015-04-22 21:24:19 -070043 * @param payLoad payload byte data
jcc3d4e14a2015-04-21 11:32:05 +080044 * @return FlowRuleExtPayLoad payLoad
45 */
46 public static FlowRuleExtPayLoad flowRuleExtPayLoad(byte[] payLoad) {
47 return new FlowRuleExtPayLoad(payLoad);
48 }
49
50 /**
51 * Returns private flow.
52 *
53 * @return payLoad private flow
54 */
55 public byte[] payLoad() {
56 return payLoad;
57 }
58
59 @Override
60 public int hashCode() {
Sho SHIMIZUc9d8d0a2015-09-09 14:09:26 -070061 return Arrays.hashCode(payLoad);
jcc3d4e14a2015-04-21 11:32:05 +080062 }
63
64 public int hash() {
Sho SHIMIZUc9d8d0a2015-09-09 14:09:26 -070065 return Arrays.hashCode(payLoad);
jcc3d4e14a2015-04-21 11:32:05 +080066 }
67
68 @Override
69 public boolean equals(Object obj) {
70 if (this == obj) {
71 return true;
72 }
73 if (obj instanceof FlowRuleExtPayLoad) {
74 FlowRuleExtPayLoad that = (FlowRuleExtPayLoad) obj;
75 return Arrays.equals(payLoad, that.payLoad);
76
77 }
78 return false;
79 }
80
81 @Override
82 public String toString() {
83 return toStringHelper(this).add("payLoad", payLoad).toString();
84 }
85}