EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.vcloud.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [CatalogItemImpl.java]

nameclass, %method, %block, %line, %
CatalogItemImpl.java100% (1/1)25%  (2/8)36%  (69/190)42%  (17/40)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CatalogItemImpl100% (1/1)25%  (2/8)36%  (69/190)42%  (17/40)
getDescription (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getEntity (): ReferenceType 0%   (0/1)0%   (0/3)0%   (0/1)
getProperties (): Map 0%   (0/1)0%   (0/3)0%   (0/1)
getType (): String 0%   (0/1)0%   (0/2)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/46)0%   (0/6)
toString (): String 0%   (0/1)0%   (0/37)0%   (0/1)
equals (Object): boolean 100% (1/1)62%  (44/71)48%  (11/23)
CatalogItemImpl (String, URI, String, ReferenceType, Map): void 100% (1/1)100% (25/25)100% (6/6)

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.vcloud.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.Map;
25 
26import javax.annotation.Nullable;
27 
28import org.jclouds.vcloud.VCloudMediaType;
29import org.jclouds.vcloud.domain.CatalogItem;
30import org.jclouds.vcloud.domain.ReferenceType;
31 
32import com.google.common.collect.Maps;
33 
34/**
35 * 
36 * @author Adrian Cole
37 * 
38 */
39public class CatalogItemImpl extends ReferenceTypeImpl implements CatalogItem {
40 
41   /** The serialVersionUID */
42   private static final long serialVersionUID = 8464716396538298809L;
43   private final String description;
44   private final ReferenceType entity;
45   private final Map<String, String> properties = Maps.newLinkedHashMap();
46 
47   public CatalogItemImpl(String name, URI id, @Nullable String description, ReferenceType entity,
48         Map<String, String> properties) {
49      super(name, VCloudMediaType.CATALOGITEM_XML, id);
50      this.description = description;
51      this.entity = checkNotNull(entity, "entity");
52      this.properties.putAll(checkNotNull(properties, "properties"));
53   }
54 
55   @Override
56   public String getType() {
57      return VCloudMediaType.CATALOGITEM_XML;
58   }
59 
60   public ReferenceType getEntity() {
61      return entity;
62   }
63 
64   @Override
65   public String getDescription() {
66      return description;
67   }
68 
69   public Map<String, String> getProperties() {
70      return properties;
71   }
72 
73   @Override
74   public String toString() {
75      return "CatalogItemImpl [id=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description="
76            + getDescription() + ", entity=" + entity + ", properties=" + properties + "]";
77   }
78 
79   @Override
80   public int hashCode() {
81      final int prime = 31;
82      int result = super.hashCode();
83      result = prime * result + ((description == null) ? 0 : description.hashCode());
84      result = prime * result + ((entity == null) ? 0 : entity.hashCode());
85      result = prime * result + ((properties == null) ? 0 : properties.hashCode());
86      return result;
87   }
88 
89   @Override
90   public boolean equals(Object obj) {
91      if (this == obj)
92         return true;
93      if (!super.equals(obj))
94         return false;
95      if (getClass() != obj.getClass())
96         return false;
97      CatalogItemImpl other = (CatalogItemImpl) obj;
98      if (description == null) {
99         if (other.description != null)
100            return false;
101      } else if (!description.equals(other.description))
102         return false;
103      if (entity == null) {
104         if (other.entity != null)
105            return false;
106      } else if (!entity.equals(other.entity))
107         return false;
108      if (properties == null) {
109         if (other.properties != null)
110            return false;
111      } else if (!properties.equals(other.properties))
112         return false;
113      return true;
114   }
115 
116}

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