1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.cloudsigma.domain;
20
21 import static com.google.common.base.Preconditions.checkNotNull;
22
23 import javax.annotation.Nullable;
24
25
26
27
28
29 public class VLANInfo {
30 public static class Builder {
31 protected String uuid;
32 protected String name;
33 protected String user;
34
35 public Builder uuid(String uuid) {
36 this.uuid = uuid;
37 return this;
38 }
39
40 public Builder name(String name) {
41 this.name = name;
42 return this;
43 }
44
45 public Builder user(String user) {
46 this.user = user;
47 return this;
48 }
49
50 public VLANInfo build() {
51 return new VLANInfo(uuid, name, user);
52 }
53
54 @Override
55 public int hashCode() {
56 final int prime = 31;
57 int result = 1;
58 result = prime * result + ((name == null) ? 0 : name.hashCode());
59 result = prime * result + ((user == null) ? 0 : user.hashCode());
60 result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
61 return result;
62 }
63
64 @Override
65 public boolean equals(Object obj) {
66 if (this == obj)
67 return true;
68 if (obj == null)
69 return false;
70 if (getClass() != obj.getClass())
71 return false;
72 Builder other = (Builder) obj;
73 if (name == null) {
74 if (other.name != null)
75 return false;
76 } else if (!name.equals(other.name))
77 return false;
78 if (user == null) {
79 if (other.user != null)
80 return false;
81 } else if (!user.equals(other.user))
82 return false;
83 if (uuid == null) {
84 if (other.uuid != null)
85 return false;
86 } else if (!uuid.equals(other.uuid))
87 return false;
88 return true;
89 }
90 }
91
92 @Nullable
93 protected final String uuid;
94 protected final String name;
95 protected final String user;
96
97 public VLANInfo(String uuid, String name, String user) {
98 this.uuid = checkNotNull(uuid, "uuid");
99 this.name = checkNotNull(name, "name");
100 this.user = checkNotNull(user, "user");
101 }
102
103
104
105
106
107 @Nullable
108 public String getUuid() {
109 return uuid;
110 }
111
112
113
114
115
116 public String getName() {
117 return name;
118 }
119
120
121
122
123
124 public String getUser() {
125 return user;
126 }
127
128 @Override
129 public int hashCode() {
130 final int prime = 31;
131 int result = 1;
132 result = prime * result + ((name == null) ? 0 : name.hashCode());
133 result = prime * result + ((user == null) ? 0 : user.hashCode());
134 return result;
135 }
136
137 @Override
138 public boolean equals(Object obj) {
139 if (this == obj)
140 return true;
141 if (obj == null)
142 return false;
143 if (getClass() != obj.getClass())
144 return false;
145 VLANInfo other = (VLANInfo) obj;
146 if (name == null) {
147 if (other.name != null)
148 return false;
149 } else if (!name.equals(other.name))
150 return false;
151 if (user == null) {
152 if (other.user != null)
153 return false;
154 } else if (!user.equals(other.user))
155 return false;
156
157 return true;
158 }
159
160 @Override
161 public String toString() {
162 return "[uuid=" + uuid + ", name=" + name + ", user=" + user + "]";
163 }
164
165 }