EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.vcloud.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [CatalogItemImpl.java]

nameclass, %method, %block, %line, %
CatalogItemImpl.java100% (1/1)38%  (3/8)38%  (72/190)45%  (18/40)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CatalogItemImpl100% (1/1)38%  (3/8)38%  (72/190)45%  (18/40)
getDescription (): String 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)
getEntity (): ReferenceType 100% (1/1)100% (3/3)100% (1/1)

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 */
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 org.jclouds.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   private final String description;
42   private final ReferenceType entity;
43   private final Map<String, String> properties = Maps.newLinkedHashMap();
44 
45   public CatalogItemImpl(String name, URI id, @Nullable String description, ReferenceType entity,
46         Map<String, String> properties) {
47      super(name, VCloudMediaType.CATALOGITEM_XML, id);
48      this.description = description;
49      this.entity = checkNotNull(entity, "entity");
50      this.properties.putAll(checkNotNull(properties, "properties"));
51   }
52 
53   @Override
54   public String getType() {
55      return VCloudMediaType.CATALOGITEM_XML;
56   }
57 
58   public ReferenceType getEntity() {
59      return entity;
60   }
61 
62   @Override
63   public String getDescription() {
64      return description;
65   }
66 
67   public Map<String, String> getProperties() {
68      return properties;
69   }
70 
71   @Override
72   public String toString() {
73      return "CatalogItemImpl [id=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description="
74            + getDescription() + ", entity=" + entity + ", properties=" + properties + "]";
75   }
76 
77   @Override
78   public int hashCode() {
79      final int prime = 31;
80      int result = super.hashCode();
81      result = prime * result + ((description == null) ? 0 : description.hashCode());
82      result = prime * result + ((entity == null) ? 0 : entity.hashCode());
83      result = prime * result + ((properties == null) ? 0 : properties.hashCode());
84      return result;
85   }
86 
87   @Override
88   public boolean equals(Object obj) {
89      if (this == obj)
90         return true;
91      if (!super.equals(obj))
92         return false;
93      if (getClass() != obj.getClass())
94         return false;
95      CatalogItemImpl other = (CatalogItemImpl) obj;
96      if (description == null) {
97         if (other.description != null)
98            return false;
99      } else if (!description.equals(other.description))
100         return false;
101      if (entity == null) {
102         if (other.entity != null)
103            return false;
104      } else if (!entity.equals(other.entity))
105         return false;
106      if (properties == null) {
107         if (other.properties != null)
108            return false;
109      } else if (!properties.equals(other.properties))
110         return false;
111      return true;
112   }
113 
114}

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