EMMA Coverage Report (generated Tue Jun 21 05:51:52 EDT 2011)
[all classes][org.jclouds.compute.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [ComputeMetadataImpl.java]

nameclass, %method, %block, %line, %
ComputeMetadataImpl.java100% (1/1)40%  (2/5)22%  (23/105)19%  (5/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComputeMetadataImpl100% (1/1)40%  (2/5)22%  (23/105)19%  (5/26)
equals (Object): boolean 0%   (0/1)0%   (0/46)0%   (0/15)
getType (): ComputeType 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/33)0%   (0/5)
ComputeMetadataImpl (ComputeType, String, String, String, Location, URI, Map)... 100% (1/1)100% (20/20)100% (4/4)
getId (): String 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.compute.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.Map;
25 
26import org.jclouds.compute.domain.ComputeMetadata;
27import org.jclouds.compute.domain.ComputeType;
28import org.jclouds.domain.Location;
29import org.jclouds.domain.internal.ResourceMetadataImpl;
30 
31/**
32 * @author Adrian Cole
33 * @author Ivan Meredith
34 */
35public class ComputeMetadataImpl extends ResourceMetadataImpl<ComputeType> implements ComputeMetadata {
36   /** The serialVersionUID */
37   private static final long serialVersionUID = 7374704415964898694L;
38   private final String id;
39   private final ComputeType type;
40 
41   public ComputeMetadataImpl(ComputeType type, String providerId, String name, String id, Location location, URI uri,
42         Map<String, String> userMetadata) {
43      super(providerId, name, location, uri, userMetadata);
44      this.id = checkNotNull(id, "id");
45      this.type = checkNotNull(type, "type");
46   }
47 
48   /**
49    * {@inheritDoc}
50    */
51   @Override
52   public ComputeType getType() {
53      return type;
54   }
55 
56   /**
57    * {@inheritDoc}
58    */
59   @Override
60   public String getId() {
61      return id;
62   }
63 
64   @Override
65   public int hashCode() {
66      final int prime = 31;
67      int result = super.hashCode();
68      result = prime * result + ((id == null) ? 0 : id.hashCode());
69      result = prime * result + ((type == null) ? 0 : type.hashCode());
70      return result;
71   }
72 
73   @Override
74   public boolean equals(Object obj) {
75      if (this == obj)
76         return true;
77      if (!super.equals(obj))
78         return false;
79      if (getClass() != obj.getClass())
80         return false;
81      ComputeMetadataImpl other = (ComputeMetadataImpl) obj;
82      if (id == null) {
83         if (other.id != null)
84            return false;
85      } else if (!id.equals(other.id))
86         return false;
87      if (type != other.type)
88         return false;
89      return true;
90   }
91 
92}

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