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

COVERAGE SUMMARY FOR SOURCE FILE [BaseHardwareProperty.java]

nameclass, %method, %block, %line, %
BaseHardwareProperty.java100% (1/1)38%  (3/8)62%  (123/199)57%  (24.6/43)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BaseHardwareProperty100% (1/1)38%  (3/8)62%  (123/199)57%  (24.6/43)
getKind (): HardwareProperty$Kind 0%   (0/1)0%   (0/3)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getUnit (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getValue (): Object 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)
equals (Object): boolean 100% (1/1)62%  (47/76)48%  (12/25)
hashCode (): int 100% (1/1)86%  (50/58)94%  (6.6/7)
BaseHardwareProperty (HardwareProperty$Kind, String, String, Object): void 100% (1/1)100% (26/26)100% (6/6)

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.deltacloud.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import org.jclouds.deltacloud.domain.HardwareProperty;
24 
25/**
26 * 
27 * @author Adrian Cole
28 */
29public class BaseHardwareProperty implements HardwareProperty {
30   private final Kind kind;
31   private final String name;
32   private final String unit;
33   private final Object value;
34 
35   public BaseHardwareProperty(Kind kind, String name, String unit, Object value) {
36      this.kind = checkNotNull(kind, "kind");
37      this.name = checkNotNull(name, "name");
38      this.unit = checkNotNull(unit, "unit");
39      this.value = checkNotNull(value, "value");
40   }
41 
42   /**
43    * {@inheritDoc}
44    */
45   @Override
46   public Kind getKind() {
47      return kind;
48   }
49 
50   /**
51    * {@inheritDoc}
52    */
53   @Override
54   public String getName() {
55      return name;
56   }
57 
58   /**
59    * {@inheritDoc}
60    */
61   @Override
62   public String getUnit() {
63      return unit;
64   }
65 
66   /**
67    * {@inheritDoc}
68    */
69   @Override
70   public Object getValue() {
71      return value;
72   }
73 
74   @Override
75   public int hashCode() {
76      final int prime = 31;
77      int result = 1;
78      result = prime * result + ((kind == null) ? 0 : kind.hashCode());
79      result = prime * result + ((name == null) ? 0 : name.hashCode());
80      result = prime * result + ((unit == null) ? 0 : unit.hashCode());
81      result = prime * result + ((value == null) ? 0 : value.hashCode());
82      return result;
83   }
84 
85   @Override
86   public boolean equals(Object obj) {
87      if (this == obj)
88         return true;
89      if (obj == null)
90         return false;
91      if (getClass() != obj.getClass())
92         return false;
93      BaseHardwareProperty other = (BaseHardwareProperty) obj;
94      if (kind != other.kind)
95         return false;
96      if (name == null) {
97         if (other.name != null)
98            return false;
99      } else if (!name.equals(other.name))
100         return false;
101      if (unit == null) {
102         if (other.unit != null)
103            return false;
104      } else if (!unit.equals(other.unit))
105         return false;
106      if (value == null) {
107         if (other.value != null)
108            return false;
109      } else if (!value.equals(other.value))
110         return false;
111      return true;
112   }
113 
114   @Override
115   public String toString() {
116      return "[kind=" + kind + ", name=" + name + ", unit=" + unit + ", value=" + value + "]";
117   }
118 
119}

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