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 import java.util.List;
23
24
25
26
27 public class VAppExtendedInfo implements Comparable<VAppExtendedInfo> {
28 private final String id;
29 private final URI href;
30 private final String name;
31 private final List<String> tags;
32 private final String longName;
33 private final List<NetworkAdapter> networkAdapters;
34
35 public VAppExtendedInfo(String id, URI href, String name, List<String> tags, String longName,
36 List<NetworkAdapter> networkAdapters) {
37 this.id = id;
38 this.href = href;
39 this.name = name;
40 this.tags = tags;
41 this.longName = longName;
42 this.networkAdapters = networkAdapters;
43 }
44
45 public int compareTo(VAppExtendedInfo that) {
46 return (this == that) ? 0 : getHref().compareTo(that.getHref());
47 }
48
49 public String getId() {
50 return id;
51 }
52
53 public URI getHref() {
54 return href;
55 }
56
57 public String getName() {
58 return name;
59 }
60
61 public List<String> getTags() {
62 return tags;
63 }
64
65 public String getLongName() {
66 return longName;
67 }
68
69 public List<NetworkAdapter> getNetworkAdapters() {
70 return networkAdapters;
71 }
72
73 @Override
74 public int hashCode() {
75 final int prime = 31;
76 int result = 1;
77 result = prime * result + ((href == null) ? 0 : href.hashCode());
78 result = prime * result + ((id == null) ? 0 : id.hashCode());
79 result = prime * result + ((name == null) ? 0 : name.hashCode());
80 result = prime * result + ((longName == null) ? 0 : longName.hashCode());
81 result = prime * result + ((tags == null) ? 0 : tags.hashCode());
82 result = prime * result + ((networkAdapters == null) ? 0 : networkAdapters.hashCode());
83 return result;
84 }
85
86 @Override
87 public boolean equals(Object obj) {
88 if (this == obj)
89 return true;
90 if (obj == null)
91 return false;
92 if (getClass() != obj.getClass())
93 return false;
94 VAppExtendedInfo other = (VAppExtendedInfo) obj;
95 if (href == null) {
96 if (other.href != null)
97 return false;
98 } else if (!href.equals(other.href))
99 return false;
100 if (id == null) {
101 if (other.id != null)
102 return false;
103 } else if (!id.equals(other.id))
104 return false;
105 if (name == null) {
106 if (other.name != null)
107 return false;
108 } else if (!name.equals(other.name))
109 return false;
110 if (tags == null) {
111 if (other.tags != null)
112 return false;
113 } else if (!tags.equals(other.tags))
114 return false;
115 if (networkAdapters == null) {
116 if (other.networkAdapters != null)
117 return false;
118 } else if (!networkAdapters.equals(other.networkAdapters))
119 return false;
120 return true;
121 }
122
123 @Override
124 public String toString() {
125 return "[href=" + href + ", id=" + id + ", name=" + name + ", long name=" + longName
126 + ", tags=" + tags.toString() + ", network adapters=" + networkAdapters.toString() + "]";
127 }
128 }