alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
alshabib | eadfc8e | 2015-08-18 15:40:46 -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 | */ |
| 16 | package org.onosproject.incubator.store.meter.impl; |
| 17 | |
| 18 | import org.onosproject.cluster.NodeId; |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 19 | import org.onosproject.net.meter.Meter; |
| 20 | import org.onosproject.net.meter.MeterFailReason; |
alshabib | eadfc8e | 2015-08-18 15:40:46 -0700 | [diff] [blame] | 21 | |
| 22 | import java.util.Optional; |
| 23 | |
| 24 | /** |
| 25 | * A class representing the meter information stored in the meter store. |
| 26 | */ |
| 27 | public class MeterData { |
| 28 | |
| 29 | private final Meter meter; |
| 30 | private final Optional<MeterFailReason> reason; |
| 31 | private final NodeId origin; |
| 32 | |
| 33 | public MeterData(Meter meter, MeterFailReason reason, NodeId origin) { |
| 34 | this.meter = meter; |
| 35 | this.reason = Optional.ofNullable(reason); |
| 36 | this.origin = origin; |
| 37 | } |
| 38 | |
| 39 | public Meter meter() { |
| 40 | return meter; |
| 41 | } |
| 42 | |
| 43 | public Optional<MeterFailReason> reason() { |
| 44 | return this.reason; |
| 45 | } |
| 46 | |
| 47 | public NodeId origin() { |
| 48 | return this.origin; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | } |