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

COVERAGE SUMMARY FOR SOURCE FILE [DomainRecord.java]

nameclass, %method, %block, %line, %
DomainRecord.java75%  (3/4)68%  (17/25)78%  (174/223)78%  (31.4/40)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DomainRecord100% (1/1)46%  (6/13)77%  (96/125)67%  (15.4/23)
getData (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getHost (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getTtl (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getType (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getname (): String 0%   (0/1)0%   (0/3)0%   (0/1)
toBuilder (): DomainRecord$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
equals (Object): boolean 100% (1/1)84%  (21/25)84%  (3.4/4)
DomainRecord (String, String, String, String, String, int): void 100% (1/1)100% (30/30)100% (8/8)
builder (): DomainRecord$Builder 100% (1/1)100% (5/5)100% (1/1)
hashCode (): int 100% (1/1)100% (9/9)100% (1/1)
string (): Objects$ToStringHelper 100% (1/1)100% (27/27)100% (1/1)
toString (): String 100% (1/1)100% (4/4)100% (1/1)
     
class DomainRecord$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class DomainRecord$Builder100% (1/1)89%  (8/9)78%  (70/90)93%  (14/15)
fromDomainRecord (DomainRecord): DomainRecord$Builder 0%   (0/1)0%   (0/20)0%   (0/1)
DomainRecord$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): DomainRecord 100% (1/1)100% (16/16)100% (1/1)
data (String): DomainRecord$Builder 100% (1/1)100% (9/9)100% (2/2)
domainname (String): DomainRecord$Builder 100% (1/1)100% (9/9)100% (2/2)
host (String): DomainRecord$Builder 100% (1/1)100% (9/9)100% (2/2)
id (String): DomainRecord$Builder 100% (1/1)100% (9/9)100% (2/2)
ttl (int): DomainRecord$Builder 100% (1/1)100% (6/6)100% (2/2)
type (String): DomainRecord$Builder 100% (1/1)100% (9/9)100% (2/2)
     
class DomainRecord$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
DomainRecord$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
DomainRecord$ConcreteBuilder (DomainRecord$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): DomainRecord$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 org.jclouds.javax.annotation.Nullable;
24 
25import com.google.common.base.Objects;
26import com.google.common.base.Objects.ToStringHelper;
27 
28/**
29 * DNS record data.
30 *
31 * @author Adam Lowe
32 * @see <a href= "https://customer.glesys.com/api.php?a=doc#domain_list_records" />
33 */
34public class DomainRecord {
35 
36   public static Builder<?> builder() {
37      return new ConcreteBuilder();
38   }
39 
40   public Builder<?> toBuilder() {
41      return new ConcreteBuilder().fromDomainRecord(this);
42   }
43 
44   public abstract static class Builder<T extends Builder<T>> {
45      protected abstract T self();
46 
47      protected String id;
48      protected String domainname;
49      protected String host;
50      protected String type;
51      protected String data;
52      protected int ttl;
53 
54      /**
55       * @see DomainRecord#getId()
56       */
57      public T id(String id) {
58         this.id = checkNotNull(id, "id");
59         return self();
60      }
61 
62      /**
63       * @see DomainRecord#getname()
64       */
65      public T domainname(String domainname) {
66         this.domainname = checkNotNull(domainname, "domainname");
67         return self();
68      }
69 
70      /**
71       * @see DomainRecord#getHost()
72       */
73      public T host(String host) {
74         this.host = checkNotNull(host, "host");
75         return self();
76      }
77 
78      /**
79       * @see DomainRecord#getType()
80       */
81      public T type(String type) {
82         this.type = checkNotNull(type, "type");
83         return self();
84      }
85 
86      /**
87       * @see DomainRecord#getData()
88       */
89      public T data(String data) {
90         this.data = checkNotNull(data, "data");
91         return self();
92      }
93 
94      /**
95       * @see DomainRecord#getTtl()
96       */
97      public T ttl(int ttl) {
98         this.ttl = ttl;
99         return self();
100      }
101 
102      public DomainRecord build() {
103         return new DomainRecord(id, domainname, host, type, data, ttl);
104      }
105 
106      public T fromDomainRecord(DomainRecord in) {
107         return this.id(in.getId())
108               .domainname(in.getname())
109               .host(in.getHost())
110               .type(in.getType())
111               .data(in.getData())
112               .ttl(in.getTtl());
113      }
114   }
115 
116   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
117      @Override
118      protected ConcreteBuilder self() {
119         return this;
120      }
121   }
122 
123   private final String id;
124   private final String domainname;
125   private final String host;
126   private final String type;
127   private final String data;
128   private final int ttl;
129 
130   @ConstructorProperties({
131         "recordid", "domainname", "host", "type", "data", "ttl"
132   })
133   protected DomainRecord(@Nullable String id, String domainname, String host, String type, @Nullable String data, int ttl) {
134      this.id = id;
135      this.domainname = checkNotNull(domainname, "domainname");
136      this.host = checkNotNull(host, "host");
137      this.type = checkNotNull(type, "type");
138      this.data = data;
139      this.ttl = ttl;
140   }
141 
142   /**
143    * @return the id of the record used to modify it via the API
144    * @see org.jclouds.glesys.features.DomainApi
145    */
146   public String getId() {
147      return this.id;
148   }
149 
150   /**
151    * @return the zone content of the record
152    */
153   public String getname() {
154      return this.domainname;
155   }
156 
157   /**
158    * @return the host content of the record
159    */
160   public String getHost() {
161      return this.host;
162   }
163 
164   /**
165    * @return the type of the record, ex. "A"
166    */
167   public String getType() {
168      return this.type;
169   }
170 
171   /**
172    * @return the data content of the record
173    */
174   @Nullable
175   public String getData() {
176      return this.data;
177   }
178 
179   /**
180    * @return the TTL/Time-to-live for the record
181    */
182   public int getTtl() {
183      return this.ttl;
184   }
185 
186   @Override
187   public int hashCode() {
188      return Objects.hashCode(id);
189   }
190 
191   @Override
192   public boolean equals(Object obj) {
193      if (this == obj) return true;
194      if (obj == null || getClass() != obj.getClass()) return false;
195      DomainRecord that = DomainRecord.class.cast(obj);
196      return Objects.equal(this.id, that.id);
197   }
198 
199   protected ToStringHelper string() {
200      return Objects.toStringHelper("")
201            .add("id", id).add("domainname", domainname).add("host", host).add("type", type).add("data", data)
202            .add("ttl", ttl);
203   }
204 
205   @Override
206   public String toString() {
207      return string().toString();
208   }
209 
210}

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