Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net; |
Yuta HIGUCHI | 39ede6a | 2014-10-03 15:23:33 -0700 | [diff] [blame] | 17 | |
Thomas Vachuska | 442d26a | 2014-10-31 08:45:14 -0700 | [diff] [blame] | 18 | /** |
| 19 | * Utility for processing annotations. |
| 20 | */ |
Yuta HIGUCHI | 39ede6a | 2014-10-03 15:23:33 -0700 | [diff] [blame] | 21 | public final class AnnotationsUtil { |
| 22 | |
| 23 | public static boolean isEqual(Annotations lhs, Annotations rhs) { |
| 24 | if (lhs == rhs) { |
| 25 | return true; |
| 26 | } |
| 27 | if (lhs == null || rhs == null) { |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | if (!lhs.keys().equals(rhs.keys())) { |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | for (String key : lhs.keys()) { |
| 36 | if (!lhs.value(key).equals(rhs.value(key))) { |
| 37 | return false; |
| 38 | } |
| 39 | } |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | // not to be instantiated |
| 44 | private AnnotationsUtil() {} |
| 45 | } |