EMMA Coverage Report (generated Wed Aug 10 12:30:04 EDT 2011)
[all classes][org.jclouds.elasticstack.domain]

COVERAGE SUMMARY FOR SOURCE FILE [Item.java]

nameclass, %method, %block, %line, %
Item.java100% (2/2)69%  (11/16)42%  (155/371)43%  (37.7/87)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Item$Builder100% (1/1)62%  (5/8)19%  (37/192)23%  (11/47)
build (): Item 0%   (0/1)0%   (0/12)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/85)0%   (0/28)
hashCode (): int 0%   (0/1)0%   (0/58)0%   (0/7)
Item$Builder (): void 100% (1/1)100% (9/9)100% (3/3)
name (String): Item$Builder 100% (1/1)100% (5/5)100% (2/2)
tags (Iterable): Item$Builder 100% (1/1)100% (9/9)100% (2/2)
userMetadata (Map): Item$Builder 100% (1/1)100% (9/9)100% (2/2)
uuid (String): Item$Builder 100% (1/1)100% (5/5)100% (2/2)
     
class Item100% (1/1)75%  (6/8)66%  (118/179)67%  (26.7/40)
getUuid (): String 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)
equals (Object): boolean 100% (1/1)64%  (44/69)52%  (12/23)
hashCode (): int 100% (1/1)87%  (39/45)95%  (5.7/6)
Item (String, String, Iterable, Map): void 100% (1/1)100% (26/26)100% (6/6)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getTags (): Set 100% (1/1)100% (3/3)100% (1/1)
getUserMetadata (): Map 100% (1/1)100% (3/3)100% (1/1)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19package org.jclouds.elasticstack.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Map;
24import java.util.Set;
25 
26import javax.annotation.Nullable;
27 
28import com.google.common.collect.ImmutableMap;
29import com.google.common.collect.ImmutableSet;
30 
31/**
32 * 
33 * @author Adrian Cole
34 */
35public class Item {
36   public static class Builder {
37      protected String uuid;
38      protected String name;
39      protected Set<String> tags = ImmutableSet.of();
40      protected Map<String, String> userMetadata = ImmutableMap.of();
41 
42      public Builder uuid(String uuid) {
43         this.uuid = uuid;
44         return this;
45      }
46 
47      public Builder name(String name) {
48         this.name = name;
49         return this;
50      }
51 
52      public Builder tags(Iterable<String> tags) {
53         this.tags = ImmutableSet.copyOf(checkNotNull(tags, "tags"));
54         return this;
55      }
56 
57      public Builder userMetadata(Map<String, String> userMetadata) {
58         this.userMetadata = ImmutableMap.copyOf(checkNotNull(userMetadata, "userMetadata"));
59         return this;
60      }
61 
62      public Item build() {
63         return new Item(uuid, name, tags, userMetadata);
64      }
65 
66      @Override
67      public int hashCode() {
68         final int prime = 31;
69         int result = 1;
70         result = prime * result + ((name == null) ? 0 : name.hashCode());
71         result = prime * result + ((tags == null) ? 0 : tags.hashCode());
72         result = prime * result + ((userMetadata == null) ? 0 : userMetadata.hashCode());
73         result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
74         return result;
75      }
76 
77      @Override
78      public boolean equals(Object obj) {
79         if (this == obj)
80            return true;
81         if (obj == null)
82            return false;
83         if (getClass() != obj.getClass())
84            return false;
85         Builder other = (Builder) obj;
86         if (name == null) {
87            if (other.name != null)
88               return false;
89         } else if (!name.equals(other.name))
90            return false;
91         if (tags == null) {
92            if (other.tags != null)
93               return false;
94         } else if (!tags.equals(other.tags))
95            return false;
96         if (userMetadata == null) {
97            if (other.userMetadata != null)
98               return false;
99         } else if (!userMetadata.equals(other.userMetadata))
100            return false;
101         if (uuid == null) {
102            if (other.uuid != null)
103               return false;
104         } else if (!uuid.equals(other.uuid))
105            return false;
106         return true;
107      }
108   }
109 
110   @Nullable
111   protected final String uuid;
112   protected final String name;
113   protected final Set<String> tags;
114   protected final Map<String, String> userMetadata;
115 
116   public Item(@Nullable String uuid, String name, Iterable<String> tags, Map<String, String> userMetadata) {
117      this.uuid = uuid;
118      this.name = checkNotNull(name, "name");
119      this.tags = ImmutableSet.copyOf(checkNotNull(tags, "tags"));
120      this.userMetadata = ImmutableMap.copyOf(checkNotNull(userMetadata, "userMetadata"));
121   }
122 
123   /**
124    * 
125    * @return uuid of the item.
126    */
127   @Nullable
128   public String getUuid() {
129      return uuid;
130   }
131 
132   /**
133    * 
134    * @return name of the item
135    */
136   public String getName() {
137      return name;
138   }
139 
140   /**
141    * 
142    * @return list of tags
143    */
144   public Set<String> getTags() {
145      return tags;
146   }
147 
148   /**
149    * 
150    * @return user-defined KEY VALUE pairs
151    */
152   public Map<String, String> getUserMetadata() {
153      return userMetadata;
154   }
155 
156   @Override
157   public int hashCode() {
158      final int prime = 31;
159      int result = 1;
160      result = prime * result + ((name == null) ? 0 : name.hashCode());
161      result = prime * result + ((tags == null) ? 0 : tags.hashCode());
162      result = prime * result + ((userMetadata == null) ? 0 : userMetadata.hashCode());
163      return result;
164   }
165 
166   @Override
167   public boolean equals(Object obj) {
168      if (this == obj)
169         return true;
170      if (obj == null)
171         return false;
172      if (getClass() != obj.getClass())
173         return false;
174      Item other = (Item) obj;
175      if (name == null) {
176         if (other.name != null)
177            return false;
178      } else if (!name.equals(other.name))
179         return false;
180      if (tags == null) {
181         if (other.tags != null)
182            return false;
183      } else if (!tags.equals(other.tags))
184         return false;
185      if (userMetadata == null) {
186         if (other.userMetadata != null)
187            return false;
188      } else if (!userMetadata.equals(other.userMetadata))
189         return false;
190      return true;
191   }
192 
193   @Override
194   public String toString() {
195      return "[uuid=" + uuid + ", name=" + name + ", tags=" + tags + ", userMetadata=" + userMetadata + "]";
196   }
197 
198}

[all classes][org.jclouds.elasticstack.domain]
EMMA 2.0.5312 (C) Vladimir Roubtsov