Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame] | 3 | * |
| 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 | */ |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 16 | package org.onosproject.net.flow; |
| 17 | |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 18 | import java.util.Arrays; |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 19 | |
Jonathan Hart | 2b3e22b | 2017-02-03 18:31:13 -0800 | [diff] [blame] | 20 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 21 | |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 22 | /** |
| 23 | * Represents for 3rd-party private original flow. |
Jonathan Hart | 2b3e22b | 2017-02-03 18:31:13 -0800 | [diff] [blame] | 24 | * |
| 25 | * @deprecated in Junco release |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 26 | */ |
Jonathan Hart | 2b3e22b | 2017-02-03 18:31:13 -0800 | [diff] [blame] | 27 | @Deprecated |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 28 | public 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 Vachuska | ca540c3 | 2015-04-22 21:24:19 -0700 | [diff] [blame] | 43 | * @param payLoad payload byte data |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 44 | * @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 SHIMIZU | c9d8d0a | 2015-09-09 14:09:26 -0700 | [diff] [blame] | 61 | return Arrays.hashCode(payLoad); |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | public int hash() { |
Sho SHIMIZU | c9d8d0a | 2015-09-09 14:09:26 -0700 | [diff] [blame] | 65 | return Arrays.hashCode(payLoad); |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 66 | } |
| 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 | } |