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

COVERAGE SUMMARY FOR SOURCE FILE [EmailOverview.java]

nameclass, %method, %block, %line, %
EmailOverview.java75%  (3/4)61%  (11/18)64%  (97/152)70%  (18.3/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EmailOverview100% (1/1)33%  (3/9)52%  (51/98)55%  (8.3/15)
getSummary (): EmailOverviewSummary 0%   (0/1)0%   (0/3)0%   (0/1)
gets (): Set 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/14)0%   (0/1)
string (): Objects$ToStringHelper 0%   (0/1)0%   (0/11)0%   (0/1)
toBuilder (): EmailOverview$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/4)0%   (0/1)
equals (Object): boolean 100% (1/1)86%  (30/35)83%  (3.3/4)
EmailOverview (EmailOverviewSummary, Set): void 100% (1/1)100% (16/16)100% (4/4)
builder (): EmailOverview$Builder 100% (1/1)100% (5/5)100% (1/1)
     
class EmailOverview$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class EmailOverview$Builder100% (1/1)83%  (5/6)83%  (38/46)89%  (8/9)
fromEmailOverview (EmailOverview): EmailOverview$Builder 0%   (0/1)0%   (0/8)0%   (0/1)
EmailOverview$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
build (): EmailOverview 100% (1/1)100% (8/8)100% (1/1)
domains (EmailOverviewDomain []): EmailOverview$Builder 100% (1/1)100% (5/5)100% (1/1)
domains (Set): EmailOverview$Builder 100% (1/1)100% (10/10)100% (2/2)
summary (EmailOverviewSummary): EmailOverview$Builder 100% (1/1)100% (9/9)100% (2/2)
     
class EmailOverview$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
EmailOverview$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
EmailOverview$ConcreteBuilder (EmailOverview$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): EmailOverview$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;
22import java.util.Set;
23 
24import com.google.common.annotations.Beta;
25import com.google.common.base.Objects;
26import com.google.common.base.Objects.ToStringHelper;
27import com.google.common.collect.ImmutableSet;
28 
29/**
30 * Structure containing all information about e-mail addresses for a GleSYS account
31 *
32 * @author Adam Lowe
33 * @see <a href="https://customer.glesys.com/api.php?a=doc#email_overview" />
34 */
35//TODO: find a better name for this class
36@Beta
37public class EmailOverview {
38 
39   public static Builder<?> builder() {
40      return new ConcreteBuilder();
41   }
42 
43   public Builder<?> toBuilder() {
44      return new ConcreteBuilder().fromEmailOverview(this);
45   }
46 
47   public abstract static class Builder<T extends Builder<T>> {
48      protected abstract T self();
49 
50      protected EmailOverviewSummary summary;
51      protected Set<EmailOverviewDomain> domains = ImmutableSet.of();
52 
53      /**
54       * @see EmailOverview#getSummary()
55       */
56      public T summary(EmailOverviewSummary summary) {
57         this.summary = checkNotNull(summary, "summary");
58         return self();
59      }
60 
61      /**
62       * @see EmailOverview#gets()
63       */
64      public T domains(Set<EmailOverviewDomain> domains) {
65         this.domains = ImmutableSet.copyOf(checkNotNull(domains, "domains"));
66         return self();
67      }
68 
69      public T domains(EmailOverviewDomain... in) {
70         return domains(ImmutableSet.copyOf(in));
71      }
72 
73      public EmailOverview build() {
74         return new EmailOverview(summary, domains);
75      }
76 
77      public T fromEmailOverview(EmailOverview in) {
78         return this.summary(in.getSummary()).domains(in.gets());
79      }
80   }
81 
82   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
83      @Override
84      protected ConcreteBuilder self() {
85         return this;
86      }
87   }
88 
89   private final EmailOverviewSummary summary;
90   private final Set<EmailOverviewDomain> domains;
91 
92   @ConstructorProperties({
93         "summary", "domains"
94   })
95   protected EmailOverview(EmailOverviewSummary summary, Set<EmailOverviewDomain> domains) {
96      this.summary = checkNotNull(summary, "summary");
97      this.domains = ImmutableSet.copyOf(checkNotNull(domains, "domains"));
98   }
99 
100   /**
101    * @return summary information about the account
102    */
103   public EmailOverviewSummary getSummary() {
104      return this.summary;
105   }
106 
107   /**
108    * @return the set of detailed information about the e-mail addresses and aliases for each domain
109    */
110   public Set<EmailOverviewDomain> gets() {
111      return this.domains;
112   }
113 
114   @Override
115   public int hashCode() {
116      return Objects.hashCode(summary, domains);
117   }
118 
119   @Override
120   public boolean equals(Object obj) {
121      if (this == obj) return true;
122      if (obj == null || getClass() != obj.getClass()) return false;
123      EmailOverview that = EmailOverview.class.cast(obj);
124      return Objects.equal(this.summary, that.summary)
125            && Objects.equal(this.domains, that.domains);
126   }
127 
128   protected ToStringHelper string() {
129      return Objects.toStringHelper("")
130            .add("summary", summary).add("domains", domains);
131   }
132 
133   @Override
134   public String toString() {
135      return string().toString();
136   }
137 
138}

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