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.slicehost.domain; |
20 | |
21 | /** |
22 | * |
23 | * |
24 | * @author Adrian Cole |
25 | */ |
26 | public class Image { |
27 | |
28 | private final int id; |
29 | private final String name; |
30 | |
31 | public Image(int id, String name) { |
32 | this.id = id; |
33 | this.name = name; |
34 | |
35 | } |
36 | |
37 | /** |
38 | * @return id of the image |
39 | */ |
40 | public int getId() { |
41 | return id; |
42 | } |
43 | |
44 | /** |
45 | * @return Example: Ubuntu 8.04 LTS (hardy) |
46 | */ |
47 | public String getName() { |
48 | return name; |
49 | } |
50 | |
51 | @Override |
52 | public int hashCode() { |
53 | final int prime = 31; |
54 | int result = 1; |
55 | result = prime * result + id; |
56 | result = prime * result + ((name == null) ? 0 : name.hashCode()); |
57 | return result; |
58 | } |
59 | |
60 | @Override |
61 | public boolean equals(Object obj) { |
62 | if (this == obj) |
63 | return true; |
64 | if (obj == null) |
65 | return false; |
66 | if (getClass() != obj.getClass()) |
67 | return false; |
68 | Image other = (Image) obj; |
69 | if (id != other.id) |
70 | return false; |
71 | if (name == null) { |
72 | if (other.name != null) |
73 | return false; |
74 | } else if (!name.equals(other.name)) |
75 | return false; |
76 | |
77 | return true; |
78 | } |
79 | |
80 | @Override |
81 | public String toString() { |
82 | return "[id=" + id + ", name=" + name + "]"; |
83 | } |
84 | |
85 | } |