Added more ignorable files to .gitignore
[ovsdb.git] / ovsdb / src / main / java / org / opendaylight / ovsdb / lib / notation / UUID.java
1 /*
2  * Copyright (C) 2013 EBay Software Foundation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Authors : Ashwin Raveendran, Madhu Venugopal
9  */
10 package org.opendaylight.ovsdb.lib.notation;
11
12 import org.opendaylight.ovsdb.lib.notation.json.UUIDSerializer;
13 import org.opendaylight.ovsdb.lib.notation.json.UUIDStringConverter;
14
15 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
16 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
17
18 @JsonDeserialize(contentConverter = UUIDStringConverter.class)
19 @JsonSerialize(using = UUIDSerializer.class)
20 /*
21  * Handles both uuid and named-uuid.
22  */
23 public class UUID {
24     String val;
25
26     public UUID(String value) {
27         this.val = value;
28     }
29
30     @Override
31     public String toString() {
32         return val;
33     }
34
35     @Override
36     public int hashCode() {
37         final int prime = 31;
38         int result = 1;
39         result = prime * result + ((val == null) ? 0 : val.hashCode());
40         return result;
41     }
42
43     @Override
44     public boolean equals(Object obj) {
45         if (this == obj)
46             return true;
47         if (obj == null)
48             return false;
49         if (getClass() != obj.getClass())
50             return false;
51         UUID other = (UUID) obj;
52         if (val == null) {
53             if (other.val != null)
54                 return false;
55         } else if (!val.equals(other.val))
56             return false;
57         return true;
58     }
59 }