Jordan Halterman | 4743258 | 2018-01-25 16:56:45 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 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.store.primitives.resources.impl; |
| 17 | |
| 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 19 | |
| 20 | /** |
| 21 | * Locked event. |
| 22 | */ |
| 23 | public class LockEvent { |
| 24 | private final int id; |
| 25 | private final long version; |
| 26 | |
| 27 | public LockEvent() { |
| 28 | this(0, 0); |
| 29 | } |
| 30 | |
| 31 | public LockEvent(int id, long version) { |
| 32 | this.id = id; |
| 33 | this.version = version; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Returns the lock ID. |
| 38 | * |
| 39 | * @return The lock ID. |
| 40 | */ |
| 41 | public int id() { |
| 42 | return id; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Returns the lock version. |
| 47 | * |
| 48 | * @return The lock version. |
| 49 | */ |
| 50 | public long version() { |
| 51 | return version; |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public String toString() { |
| 56 | return toStringHelper(this) |
| 57 | .add("id", id) |
| 58 | .add("version", version) |
| 59 | .toString(); |
| 60 | } |
| 61 | } |