EMMA Coverage Report (generated Mon Dec 09 15:12:29 EST 2013)
[all classes][org.jclouds.glesys.domain]

COVERAGE SUMMARY FOR SOURCE FILE [ResourceUsageInfo.java]

nameclass, %method, %block, %line, %
ResourceUsageInfo.java75%  (3/4)63%  (12/19)52%  (93/180)64%  (18/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ResourceUsageInfo100% (1/1)40%  (4/10)37%  (45/121)47%  (8/17)
equals (Object): boolean 0%   (0/1)0%   (0/41)0%   (0/4)
getResolution (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getResource (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getUnit (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/19)0%   (0/1)
toBuilder (): ResourceUsageInfo$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
ResourceUsageInfo (String, String, String): void 100% (1/1)100% (21/21)100% (5/5)
builder (): ResourceUsageInfo$Builder 100% (1/1)100% (5/5)100% (1/1)
string (): Objects$ToStringHelper 100% (1/1)100% (15/15)100% (1/1)
toString (): String 100% (1/1)100% (4/4)100% (1/1)
     
class ResourceUsageInfo$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class ResourceUsageInfo$Builder100% (1/1)83%  (5/6)78%  (40/51)89%  (8/9)
fromResourceUsageInfo (ResourceUsageInfo): ResourceUsageInfo$Builder 0%   (0/1)0%   (0/11)0%   (0/1)
ResourceUsageInfo$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): ResourceUsageInfo 100% (1/1)100% (10/10)100% (1/1)
resolution (String): ResourceUsageInfo$Builder 100% (1/1)100% (9/9)100% (2/2)
resource (String): ResourceUsageInfo$Builder 100% (1/1)100% (9/9)100% (2/2)
unit (String): ResourceUsageInfo$Builder 100% (1/1)100% (9/9)100% (2/2)
     
class ResourceUsageInfo$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
ResourceUsageInfo$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
ResourceUsageInfo$ConcreteBuilder (ResourceUsageInfo$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): ResourceUsageInfo$ConcreteBuilder 100% (1/1)100% (2/2)100% (1/1)

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package org.jclouds.glesys.domain;
18 
19import static com.google.common.base.Preconditions.checkNotNull;
20 
21import java.beans.ConstructorProperties;
22 
23import com.google.common.base.Objects;
24import com.google.common.base.Objects.ToStringHelper;
25 
26/**
27 * Detailed information on usage
28 *
29 * @author Adam Lowe
30 * @see ServerStatus
31 */
32public class ResourceUsageInfo {
33 
34   public static Builder<?> builder() {
35      return new ConcreteBuilder();
36   }
37 
38   public Builder<?> toBuilder() {
39      return new ConcreteBuilder().fromResourceUsageInfo(this);
40   }
41 
42   public abstract static class Builder<T extends Builder<T>>  {
43      protected abstract T self();
44 
45      protected String resource;
46      protected String resolution;
47      protected String unit;
48 
49      /**
50       * @see ResourceUsageInfo#getResource()
51       */
52      public T resource(String resource) {
53         this.resource = checkNotNull(resource, "resource");
54         return self();
55      }
56 
57      /**
58       * @see ResourceUsageInfo#getResolution()
59       */
60      public T resolution(String resolution) {
61         this.resolution = checkNotNull(resolution, "resolution");
62         return self();
63      }
64 
65      /**
66       * @see ResourceUsageInfo#getUnit()
67       */
68      public T unit(String unit) {
69         this.unit = checkNotNull(unit, "unit");
70         return self();
71      }
72 
73      public ResourceUsageInfo build() {
74         return new ResourceUsageInfo(resource, resolution, unit);
75      }
76 
77      public T fromResourceUsageInfo(ResourceUsageInfo in) {
78         return this
79               .resource(in.getResource())
80               .resolution(in.getResolution())
81               .unit(in.getUnit());
82      }
83   }
84 
85   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
86      @Override
87      protected ConcreteBuilder self() {
88         return this;
89      }
90   }
91 
92   private final String resource;
93   private final String resolution;
94   private final String unit;
95 
96   @ConstructorProperties({
97         "type", "resolution", "unit"
98   })
99   protected ResourceUsageInfo(String resource, String resolution, String unit) {
100      this.resource = checkNotNull(resource, "resource");
101      this.resolution = checkNotNull(resolution, "resolution");
102      this.unit = checkNotNull(unit, "unit");
103   }
104 
105   public String getResource() {
106      return this.resource;
107   }
108 
109   public String getResolution() {
110      return this.resolution;
111   }
112 
113   public String getUnit() {
114      return this.unit;
115   }
116 
117   @Override
118   public int hashCode() {
119      return Objects.hashCode(resource, resolution, unit);
120   }
121 
122   @Override
123   public boolean equals(Object obj) {
124      if (this == obj) return true;
125      if (obj == null || getClass() != obj.getClass()) return false;
126      ResourceUsageInfo that = ResourceUsageInfo.class.cast(obj);
127      return Objects.equal(this.resource, that.resource)
128            && Objects.equal(this.resolution, that.resolution)
129            && Objects.equal(this.unit, that.unit);
130   }
131 
132   protected ToStringHelper string() {
133      return Objects.toStringHelper("")
134            .add("resource", resource).add("resolution", resolution).add("unit", unit);
135   }
136 
137   @Override
138   public String toString() {
139      return string().toString();
140   }
141 
142}

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