EMMA Coverage Report (generated Wed Oct 26 13:47:17 EDT 2011)
[all classes][org.jclouds.compute.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [ComputeMetadataImpl.java]

nameclass, %method, %block, %line, %
ComputeMetadataImpl.java100% (1/1)67%  (4/6)54%  (62/115)42%  (11.8/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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