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

COVERAGE SUMMARY FOR SOURCE FILE [EmailQuota.java]

nameclass, %method, %block, %line, %
EmailQuota.java75%  (3/4)65%  (11/17)46%  (63/136)62%  (15/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EmailQuota100% (1/1)44%  (4/9)31%  (29/94)47%  (7/15)
equals (Object): boolean 0%   (0/1)0%   (0/37)0%   (0/4)
getMax (): int 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/15)0%   (0/1)
toBuilder (): EmailQuota$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
EmailQuota (int, String): void 100% (1/1)100% (9/9)100% (4/4)
builder (): EmailQuota$Builder 100% (1/1)100% (5/5)100% (1/1)
string (): Objects$ToStringHelper 100% (1/1)100% (11/11)100% (1/1)
toString (): String 100% (1/1)100% (4/4)100% (1/1)
     
class EmailQuota$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class EmailQuota$Builder100% (1/1)80%  (4/5)76%  (26/34)86%  (6/7)
fromEmailAccount (EmailQuota): EmailQuota$Builder 0%   (0/1)0%   (0/8)0%   (0/1)
EmailQuota$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): EmailQuota 100% (1/1)100% (8/8)100% (1/1)
max (int): EmailQuota$Builder 100% (1/1)100% (6/6)100% (2/2)
unit (String): EmailQuota$Builder 100% (1/1)100% (9/9)100% (2/2)
     
class EmailQuota$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
EmailQuota$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
EmailQuota$ConcreteBuilder (EmailQuota$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): EmailQuota$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 * Information on an Email Account Quota size
28 *
29 * @author Adam Lowe
30 * @see <a href="https://customer.glesys.com/api.php?a=doc#email_list" />
31 */
32public class EmailQuota {
33 
34   public static Builder<?> builder() {
35      return new ConcreteBuilder();
36   }
37 
38   public Builder<?> toBuilder() {
39      return new ConcreteBuilder().fromEmailAccount(this);
40   }
41 
42   public abstract static class Builder<T extends Builder<T>> {
43      protected abstract T self();
44 
45      protected int max;
46      protected String unit;
47 
48      /**
49       * @see EmailQuota#getMax()
50       */
51      public T max(int max) {
52         this.max = max;
53         return self();
54      }
55 
56      /**
57       * @see EmailQuota#getUnit()
58       */
59      public T unit(String unit) {
60         this.unit = checkNotNull(unit, "unit");
61         return self();
62      }
63 
64      public EmailQuota build() {
65         return new EmailQuota(max, unit);
66      }
67 
68      public T fromEmailAccount(EmailQuota in) {
69         return this.max(in.getMax()).unit(in.getUnit());
70      }
71   }
72 
73   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
74      @Override
75      protected ConcreteBuilder self() {
76         return this;
77      }
78   }
79 
80   private final int max;
81   private final String unit;
82 
83   @ConstructorProperties({
84         "max", "unit"
85   })
86   protected EmailQuota(int max, String unit) {
87      this.max = max;
88      this.unit = unit;
89   }
90 
91   /**
92    * @return the maximum size of the mailbox (in units)
93    * @see #getUnit
94    */
95   public int getMax() {
96      return this.max;
97   }
98 
99   /**
100    * @return the quota for this e-mail account
101    */
102   public String getUnit() {
103      return this.unit;
104   }
105 
106   @Override
107   public int hashCode() {
108      return Objects.hashCode(max, unit);
109   }
110 
111   @Override
112   public boolean equals(Object obj) {
113      if (this == obj) return true;
114      if (obj == null || getClass() != obj.getClass()) return false;
115      EmailQuota that = EmailQuota.class.cast(obj);
116      return Objects.equal(this.max, that.max) && Objects.equal(this.unit, that.unit);
117   }
118 
119   protected ToStringHelper string() {
120      return Objects.toStringHelper("").add("max", max).add("unit", unit);
121   }
122 
123   @Override
124   public String toString() {
125      return string().toString();
126   }
127 
128}

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