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

COVERAGE SUMMARY FOR SOURCE FILE [ServerLimit.java]

nameclass, %method, %block, %line, %
ServerLimit.java25%  (1/4)4%   (1/23)7%   (18/241)19%  (7/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ServerLimit$Builder0%   (0/1)0%   (0/8)0%   (0/64)0%   (0/13)
ServerLimit$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
barrier (long): ServerLimit$Builder 0%   (0/1)0%   (0/6)0%   (0/2)
build (): ServerLimit 0%   (0/1)0%   (0/14)0%   (0/1)
failCount (long): ServerLimit$Builder 0%   (0/1)0%   (0/6)0%   (0/2)
fromServerLimit (ServerLimit): ServerLimit$Builder 0%   (0/1)0%   (0/17)0%   (0/1)
held (long): ServerLimit$Builder 0%   (0/1)0%   (0/6)0%   (0/2)
limit (long): ServerLimit$Builder 0%   (0/1)0%   (0/6)0%   (0/2)
maxHeld (long): ServerLimit$Builder 0%   (0/1)0%   (0/6)0%   (0/2)
     
class ServerLimit$ConcreteBuilder0%   (0/1)0%   (0/3)0%   (0/8)0%   (0/2)
ServerLimit$ConcreteBuilder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
ServerLimit$ConcreteBuilder (ServerLimit$1): void 0%   (0/1)0%   (0/3)0%   (0/1)
self (): ServerLimit$ConcreteBuilder 0%   (0/1)0%   (0/2)0%   (0/1)
     
class ServerLimit100% (1/1)8%   (1/12)11%  (18/169)33%  (7/21)
builder (): ServerLimit$Builder 0%   (0/1)0%   (0/5)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/63)0%   (0/4)
getBarrier (): long 0%   (0/1)0%   (0/3)0%   (0/1)
getFailCount (): long 0%   (0/1)0%   (0/3)0%   (0/1)
getHeld (): long 0%   (0/1)0%   (0/3)0%   (0/1)
getLimit (): long 0%   (0/1)0%   (0/3)0%   (0/1)
getMaxHeld (): long 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/34)0%   (0/1)
string (): Objects$ToStringHelper 0%   (0/1)0%   (0/23)0%   (0/1)
toBuilder (): ServerLimit$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/4)0%   (0/1)
ServerLimit (long, long, long, long, long): void 100% (1/1)100% (18/18)100% (7/7)
     
class ServerLimit$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)

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 java.beans.ConstructorProperties;
20 
21import com.google.common.base.Objects;
22import com.google.common.base.Objects.ToStringHelper;
23 
24/**
25 * Detailed information about an OpenVZ server's limits
26 *
27 * @author Adam Lowe
28 * @see <a href= "https://customer.glesys.com/api.php?a=doc#server_limits" />
29 */
30public class ServerLimit {
31 
32   public static Builder<?> builder() {
33      return new ConcreteBuilder();
34   }
35 
36   public Builder<?> toBuilder() {
37      return new ConcreteBuilder().fromServerLimit(this);
38   }
39 
40   public abstract static class Builder<T extends Builder<T>> {
41      protected abstract T self();
42 
43      protected long held;
44      protected long maxHeld;
45      protected long barrier;
46      protected long limit;
47      protected long failCount;
48 
49      /**
50       * @see ServerLimit#getHeld()
51       */
52      public T held(long held) {
53         this.held = held;
54         return self();
55      }
56 
57      /**
58       * @see ServerLimit#getMaxHeld()
59       */
60      public T maxHeld(long maxHeld) {
61         this.maxHeld = maxHeld;
62         return self();
63      }
64 
65      /**
66       * @see ServerLimit#getBarrier()
67       */
68      public T barrier(long barrier) {
69         this.barrier = barrier;
70         return self();
71      }
72 
73      /**
74       * @see ServerLimit#getLimit()
75       */
76      public T limit(long limit) {
77         this.limit = limit;
78         return self();
79      }
80 
81      /**
82       * @see ServerLimit#getFailCount()
83       */
84      public T failCount(long failCount) {
85         this.failCount = failCount;
86         return self();
87      }
88 
89      public ServerLimit build() {
90         return new ServerLimit(held, maxHeld, barrier, limit, failCount);
91      }
92 
93      public T fromServerLimit(ServerLimit in) {
94         return this.held(in.getHeld())
95               .maxHeld(in.getMaxHeld())
96               .barrier(in.getBarrier())
97               .limit(in.getLimit())
98               .failCount(in.getFailCount());
99      }
100   }
101 
102   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
103      @Override
104      protected ConcreteBuilder self() {
105         return this;
106      }
107   }
108 
109   private final long held;
110   private final long maxHeld;
111   private final long barrier;
112   private final long limit;
113   private final long failCount;
114 
115   @ConstructorProperties({
116         "held", "maxHeld", "barrier", "limit", "failCount"
117   })
118   protected ServerLimit(long held, long maxHeld, long barrier, long limit, long failCount) {
119      this.held = held;
120      this.maxHeld = maxHeld;
121      this.barrier = barrier;
122      this.limit = limit;
123      this.failCount = failCount;
124   }
125 
126   public long getHeld() {
127      return this.held;
128   }
129 
130   public long getMaxHeld() {
131      return this.maxHeld;
132   }
133 
134   public long getBarrier() {
135      return this.barrier;
136   }
137 
138   public long getLimit() {
139      return this.limit;
140   }
141 
142   public long getFailCount() {
143      return this.failCount;
144   }
145 
146   @Override
147   public int hashCode() {
148      return Objects.hashCode(held, maxHeld, barrier, limit, failCount);
149   }
150 
151   @Override
152   public boolean equals(Object obj) {
153      if (this == obj) return true;
154      if (obj == null || getClass() != obj.getClass()) return false;
155      ServerLimit that = ServerLimit.class.cast(obj);
156      return Objects.equal(this.held, that.held)
157            && Objects.equal(this.maxHeld, that.maxHeld)
158            && Objects.equal(this.barrier, that.barrier)
159            && Objects.equal(this.limit, that.limit)
160            && Objects.equal(this.failCount, that.failCount);
161   }
162 
163   protected ToStringHelper string() {
164      return Objects.toStringHelper("").add("held", held).add("maxHeld", maxHeld).add("barrier", barrier)
165            .add("limit", limit).add("failCount", failCount);
166   }
167 
168   @Override
169   public String toString() {
170      return string().toString();
171   }
172 
173}

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