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

COVERAGE SUMMARY FOR SOURCE FILE [EmailAlias.java]

nameclass, %method, %block, %line, %
EmailAlias.java75%  (3/4)59%  (10/17)61%  (78/127)68%  (16.4/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EmailAlias100% (1/1)33%  (3/9)50%  (41/82)56%  (8.4/15)
getAlias (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getForwardTo (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/9)0%   (0/1)
string (): Objects$ToStringHelper 0%   (0/1)0%   (0/11)0%   (0/1)
toBuilder (): EmailAlias$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)84%  (21/25)84%  (3.4/4)
EmailAlias (String, String): void 100% (1/1)100% (15/15)100% (4/4)
builder (): EmailAlias$Builder 100% (1/1)100% (5/5)100% (1/1)
     
class EmailAlias$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class EmailAlias$Builder100% (1/1)80%  (4/5)78%  (29/37)86%  (6/7)
fromEmailAlias (EmailAlias): EmailAlias$Builder 0%   (0/1)0%   (0/8)0%   (0/1)
EmailAlias$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
alias (String): EmailAlias$Builder 100% (1/1)100% (9/9)100% (2/2)
build (): EmailAlias 100% (1/1)100% (8/8)100% (1/1)
forwardTo (String): EmailAlias$Builder 100% (1/1)100% (9/9)100% (2/2)
     
class EmailAlias$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
EmailAlias$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
EmailAlias$ConcreteBuilder (EmailAlias$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): EmailAlias$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 an Email Account
28 *
29 * @author Adam Lowe
30 * @see <a href="https://customer.glesys.com/api.php?a=doc#email_list" />
31 */
32public class EmailAlias {
33 
34   public static Builder<?> builder() {
35      return new ConcreteBuilder();
36   }
37 
38   public Builder<?> toBuilder() {
39      return new ConcreteBuilder().fromEmailAlias(this);
40   }
41 
42   public abstract static class Builder<T extends Builder<T>> {
43      protected abstract T self();
44 
45      protected String alias;
46      protected String forwardTo;
47 
48      /**
49       * @see org.jclouds.glesys.domain.EmailAlias#getAlias()
50       */
51      public T alias(String alias) {
52         this.alias = checkNotNull(alias, "alias");
53         return self();
54      }
55 
56      /**
57       * @see EmailAlias#getForwardTo()
58       */
59      public T forwardTo(String forwardTo) {
60         this.forwardTo = checkNotNull(forwardTo, "forwardTo");
61         return self();
62      }
63 
64      public EmailAlias build() {
65         return new EmailAlias(alias, forwardTo);
66      }
67 
68      public T fromEmailAlias(EmailAlias in) {
69         return this.alias(in.getAlias()).forwardTo(in.getForwardTo());
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 String alias;
81   private final String forwardTo;
82 
83   @ConstructorProperties({
84         "emailalias", "goto"
85   })
86   protected EmailAlias(String alias, String forwardTo) {
87      this.alias = checkNotNull(alias, "alias");
88      this.forwardTo = checkNotNull(forwardTo, "forwardTo");
89   }
90 
91   /**
92    * @return the e-mail address being forwarded
93    */
94   public String getAlias() {
95      return this.alias;
96   }
97 
98   /**
99    * @return the e-mail address this address forwards to
100    */
101   public String getForwardTo() {
102      return this.forwardTo;
103   }
104 
105   @Override
106   public int hashCode() {
107      return Objects.hashCode(alias);
108   }
109 
110   @Override
111   public boolean equals(Object obj) {
112      if (this == obj) return true;
113      if (obj == null || getClass() != obj.getClass()) return false;
114      EmailAlias that = EmailAlias.class.cast(obj);
115      return Objects.equal(this.alias, that.alias);
116   }
117 
118   protected ToStringHelper string() {
119      return Objects.toStringHelper("")
120            .add("alias", alias).add("forwardTo", forwardTo);
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