1 | /** |
2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
3 | * contributor license agreements. See the NOTICE file |
4 | * distributed with this work for additional information |
5 | * regarding copyright ownership. jclouds licenses this file |
6 | * to you under the Apache License, Version 2.0 (the |
7 | * "License"); you may not use this file except in compliance |
8 | * with the License. You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, |
13 | * software distributed under the License is distributed on an |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | * KIND, either express or implied. See the License for the |
16 | * specific language governing permissions and limitations |
17 | * under the License. |
18 | */ |
19 | package org.jclouds.ec2.compute.domain; |
20 | |
21 | /** |
22 | * |
23 | * @author Adrian Cole |
24 | */ |
25 | public class RegionAndName { |
26 | protected final String region; |
27 | protected final String name; |
28 | |
29 | public RegionAndName(String region, String name) { |
30 | this.region = region; |
31 | this.name = name; |
32 | } |
33 | |
34 | @Override |
35 | public int hashCode() { |
36 | final int prime = 31; |
37 | int result = 1; |
38 | result = prime * result + ((region == null) ? 0 : region.hashCode()); |
39 | result = prime * result + ((name == null) ? 0 : name.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 | RegionAndName other = (RegionAndName) obj; |
52 | if (region == null) { |
53 | if (other.region != null) |
54 | return false; |
55 | } else if (!region.equals(other.region)) |
56 | return false; |
57 | if (name == null) { |
58 | if (other.name != null) |
59 | return false; |
60 | } else if (!name.equals(other.name)) |
61 | return false; |
62 | return true; |
63 | } |
64 | |
65 | public String getRegion() { |
66 | return region; |
67 | } |
68 | |
69 | public String getName() { |
70 | return name; |
71 | } |
72 | |
73 | @Override |
74 | public String toString() { |
75 | return "[region=" + region + ", name=" + name + "]"; |
76 | } |
77 | |
78 | } |