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

COVERAGE SUMMARY FOR SOURCE FILE [ReferenceTypeImpl.java]

nameclass, %method, %block, %line, %
ReferenceTypeImpl.java100% (1/1)100% (8/8)87%  (146/168)78%  (30.6/39)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ReferenceTypeImpl100% (1/1)100% (8/8)87%  (146/168)78%  (30.6/39)
equals (Object): boolean 100% (1/1)77%  (53/69)65%  (15/23)
compareTo (ReferenceType): int 100% (1/1)82%  (9/11)81%  (0.8/1)
hashCode (): int 100% (1/1)91%  (41/45)96%  (5.8/6)
ReferenceTypeImpl (String, String, URI): void 100% (1/1)100% (12/12)100% (5/5)
getHref (): URI 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getType (): String 100% (1/1)100% (3/3)100% (1/1)
toString (): String 100% (1/1)100% (22/22)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 java.net.URI;
22 
23import org.jclouds.vcloud.domain.ReferenceType;
24 
25/**
26 * Location of a Rest resource
27 * 
28 * @author Adrian Cole
29 * 
30 */
31public class ReferenceTypeImpl implements ReferenceType {
32   private final String name;
33   private final String type;
34   private final URI href;
35 
36   public ReferenceTypeImpl(String name, String type, URI href) {
37      this.name = name;
38      this.type = type;
39      this.href = href;
40   }
41 
42   @Override
43   public String getName() {
44      return name;
45   }
46 
47   @Override
48   public String getType() {
49      return type;
50   }
51 
52   @Override
53   public URI getHref() {
54      return href;
55   }
56 
57   @Override
58   public int compareTo(ReferenceType that) {
59      return (this == that) ? 0 : getHref().compareTo(that.getHref());
60   }
61 
62   @Override
63   public int hashCode() {
64      final int prime = 31;
65      int result = 1;
66      result = prime * result + ((href == null) ? 0 : href.hashCode());
67      result = prime * result + ((name == null) ? 0 : name.hashCode());
68      result = prime * result + ((type == null) ? 0 : type.hashCode());
69      return result;
70   }
71 
72   @Override
73   public boolean equals(Object obj) {
74      if (this == obj)
75         return true;
76      if (obj == null)
77         return false;
78      if (getClass() != obj.getClass())
79         return false;
80      ReferenceTypeImpl other = (ReferenceTypeImpl) obj;
81      if (href == null) {
82         if (other.href != null)
83            return false;
84      } else if (!href.equals(other.href))
85         return false;
86      if (name == null) {
87         if (other.name != null)
88            return false;
89      } else if (!name.equals(other.name))
90         return false;
91      if (type == null) {
92         if (other.type != null)
93            return false;
94      } else if (!type.equals(other.type))
95         return false;
96      return true;
97   }
98 
99   @Override
100   public String toString() {
101      return "[href=" + href + ", name=" + name + ", type=" + type + "]";
102   }
103}

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