blob: 21cf24bf06176c360c4cf26ada32d3d3ba5022f9 [file] [log] [blame]
Madan Jampani5e5b3d62016-02-01 16:03:33 -08001/*
2 * Copyright 2016 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 */
Madan Jampanicadd70b2016-02-08 13:45:43 -080016package org.onosproject.store.primitives;
Madan Jampani5e5b3d62016-02-01 16:03:33 -080017
18import com.google.common.base.Objects;
19
20/**
21 * Transaction identifier.
22 */
23public final class TransactionId {
24
25 public static TransactionId from(String id) {
26 return new TransactionId(id);
27 }
28
29 private final String id;
30
31 private TransactionId(String id) {
32 this.id = id;
33 }
34
35 @Override
36 public String toString() {
37 return id;
38 }
39
40 @Override
41 public int hashCode() {
42 return id.hashCode();
43 }
44
45 @Override
46 public boolean equals(Object other) {
47 if (this == other) {
48 return true;
49 }
50 if (other instanceof TransactionId) {
51 TransactionId that = (TransactionId) other;
52 return Objects.equal(this.id, that.id);
53 }
54 return false;
55 }
56}