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

COVERAGE SUMMARY FOR SOURCE FILE [CatalogImpl.java]

nameclass, %method, %block, %line, %
CatalogImpl.java100% (1/1)50%  (4/8)20%  (39/199)21%  (10/47)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CatalogImpl100% (1/1)50%  (4/8)20%  (39/199)21%  (10/47)
compareTo (ReferenceType): int 0%   (0/1)0%   (0/11)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/87)0%   (0/28)
getType (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/59)0%   (0/7)
CatalogImpl (String, String, URI, String, Map): void 100% (1/1)100% (30/30)100% (7/7)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getHref (): URI 100% (1/1)100% (3/3)100% (1/1)
getName (): String 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.trmk.vcloud_0_8.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.LinkedHashMap;
25import java.util.Map;
26 
27import org.jclouds.javax.annotation.Nullable;
28 
29import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
30import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
31 
32/**
33 * Locations of resources in vCloud
34 * 
35 * @author Adrian Cole
36 * 
37 */
38public class CatalogImpl extends LinkedHashMap<String, ReferenceType> implements Catalog {
39 
40   /** The serialVersionUID */
41   private static final long serialVersionUID = 8464716396538298809L;
42   private final String name;
43   private final String type;
44   private final URI href;
45   @Nullable
46   private final String description;
47 
48   public CatalogImpl(String name, String type, URI href, @Nullable String description,
49         Map<String, ReferenceType> contents) {
50      this.name = checkNotNull(name, "name");
51      this.type = checkNotNull(type, "type");
52      this.description = description;
53      this.href = checkNotNull(href, "href");
54      putAll(checkNotNull(contents, "contents"));
55   }
56 
57   /**
58    * {@inheritDoc}
59    */
60   @Override
61   public URI getHref() {
62      return href;
63   }
64 
65   /**
66    * {@inheritDoc}
67    */
68   @Override
69   public String getName() {
70      return name;
71   }
72 
73   /**
74    * {@inheritDoc}
75    */
76   public String getDescription() {
77      return description;
78   }
79 
80   /**
81    * {@inheritDoc}
82    */
83   @Override
84   public String getType() {
85      return type;
86   }
87 
88   @Override
89   public int hashCode() {
90      final int prime = 31;
91      int result = super.hashCode();
92      result = prime * result + ((description == null) ? 0 : description.hashCode());
93      result = prime * result + ((href == null) ? 0 : href.hashCode());
94      result = prime * result + ((name == null) ? 0 : name.hashCode());
95      result = prime * result + ((type == null) ? 0 : type.hashCode());
96      return result;
97   }
98 
99   @Override
100   public boolean equals(Object obj) {
101      if (this == obj)
102         return true;
103      if (!super.equals(obj))
104         return false;
105      if (getClass() != obj.getClass())
106         return false;
107      CatalogImpl other = (CatalogImpl) obj;
108      if (description == null) {
109         if (other.description != null)
110            return false;
111      } else if (!description.equals(other.description))
112         return false;
113      if (href == null) {
114         if (other.href != null)
115            return false;
116      } else if (!href.equals(other.href))
117         return false;
118      if (name == null) {
119         if (other.name != null)
120            return false;
121      } else if (!name.equals(other.name))
122         return false;
123      if (type == null) {
124         if (other.type != null)
125            return false;
126      } else if (!type.equals(other.type))
127         return false;
128      return true;
129   }
130 
131   @Override
132   public int compareTo(ReferenceType o) {
133      return (this == o) ? 0 : getHref().compareTo(o.getHref());
134   }
135 
136}

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