1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.trmk.vcloud_0_8.domain;
20
21 import java.net.URI;
22
23 import org.jclouds.javax.annotation.Nullable;
24
25
26
27
28
29
30 public class KeyPair {
31 private final URI id;
32 private final String name;
33 private final boolean isDefault;
34 @Nullable
35 private final String privateKey;
36 private final String fingerPrint;
37
38 public KeyPair(URI id, String name, boolean isDefault, @Nullable String privateKey, String fingerPrint) {
39 this.id = id;
40 this.name = name;
41 this.isDefault = isDefault;
42 this.privateKey = privateKey;
43 this.fingerPrint = fingerPrint;
44 }
45
46 public URI getId() {
47 return id;
48 }
49
50 public String getName() {
51 return name;
52 }
53
54 public boolean isDefault() {
55 return isDefault;
56 }
57
58 @Nullable
59 public String getPrivateKey() {
60 return privateKey;
61 }
62
63 public String getFingerPrint() {
64 return fingerPrint;
65 }
66
67 @Override
68 public int hashCode() {
69 final int prime = 31;
70 int result = 1;
71 result = prime * result + ((fingerPrint == null) ? 0 : fingerPrint.hashCode());
72 result = prime * result + ((id == null) ? 0 : id.hashCode());
73 result = prime * result + (isDefault ? 1231 : 1237);
74 result = prime * result + ((name == null) ? 0 : name.hashCode());
75 result = prime * result + ((privateKey == null) ? 0 : privateKey.hashCode());
76 return result;
77 }
78
79 @Override
80 public boolean equals(Object obj) {
81 if (this == obj)
82 return true;
83 if (obj == null)
84 return false;
85 if (getClass() != obj.getClass())
86 return false;
87 KeyPair other = (KeyPair) obj;
88 if (fingerPrint == null) {
89 if (other.fingerPrint != null)
90 return false;
91 } else if (!fingerPrint.equals(other.fingerPrint))
92 return false;
93 if (id == null) {
94 if (other.id != null)
95 return false;
96 } else if (!id.equals(other.id))
97 return false;
98 if (isDefault != other.isDefault)
99 return false;
100 if (name == null) {
101 if (other.name != null)
102 return false;
103 } else if (!name.equals(other.name))
104 return false;
105 if (privateKey == null) {
106 if (other.privateKey != null)
107 return false;
108 } else if (!privateKey.equals(other.privateKey))
109 return false;
110 return true;
111 }
112
113 @Override
114 public String toString() {
115 return "Key [fingerPrint=" + fingerPrint + ", id=" + id + ", isDefault=" + isDefault + ", name=" + name
116 + ", privateKey=" + (privateKey != null) + "]";
117 }
118
119 }