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

COVERAGE SUMMARY FOR SOURCE FILE [IpDetails.java]

nameclass, %method, %block, %line, %
IpDetails.java75%  (3/4)62%  (25/40)82%  (420/510)77%  (52.4/68)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class IpDetails$Builder100% (1/1)89%  (16/18)76%  (131/173)94%  (29/31)
fromIpDetails (IpDetails): IpDetails$Builder 0%   (0/1)0%   (0/38)0%   (0/1)
version6 (): IpDetails$Builder 0%   (0/1)0%   (0/4)0%   (0/1)
IpDetails$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
address (String): IpDetails$Builder 100% (1/1)100% (6/6)100% (2/2)
broadcast (String): IpDetails$Builder 100% (1/1)100% (6/6)100% (2/2)
build (): IpDetails 100% (1/1)100% (31/31)100% (1/1)
cost (Cost): IpDetails$Builder 100% (1/1)100% (6/6)100% (2/2)
datacenter (String): IpDetails$Builder 100% (1/1)100% (9/9)100% (2/2)
gateway (String): IpDetails$Builder 100% (1/1)100% (6/6)100% (2/2)
nameServers (List): IpDetails$Builder 100% (1/1)100% (10/10)100% (2/2)
nameServers (String []): IpDetails$Builder 100% (1/1)100% (5/5)100% (1/1)
netmask (String): IpDetails$Builder 100% (1/1)100% (6/6)100% (2/2)
platform (String): IpDetails$Builder 100% (1/1)100% (9/9)100% (2/2)
ptr (String): IpDetails$Builder 100% (1/1)100% (9/9)100% (2/2)
reserved (boolean): IpDetails$Builder 100% (1/1)100% (6/6)100% (2/2)
serverId (String): IpDetails$Builder 100% (1/1)100% (6/6)100% (2/2)
version (int): IpDetails$Builder 100% (1/1)100% (6/6)100% (2/2)
version4 (): IpDetails$Builder 100% (1/1)100% (4/4)100% (1/1)
     
class IpDetails100% (1/1)32%  (6/19)85%  (281/329)61%  (21.4/35)
getAddress (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getBroadcast (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getCost (): Cost 0%   (0/1)0%   (0/3)0%   (0/1)
getDatacenter (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getGateway (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getNameServers (): List 0%   (0/1)0%   (0/3)0%   (0/1)
getNetmask (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPlatform (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPtr (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getServerId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getVersion (): int 0%   (0/1)0%   (0/3)0%   (0/1)
isReserved (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
toBuilder (): IpDetails$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
equals (Object): boolean 100% (1/1)95%  (94/99)84%  (3.4/4)
IpDetails (String, int, String, String, String, String, String, String, List,... 100% (1/1)100% (61/61)100% (14/14)
builder (): IpDetails$Builder 100% (1/1)100% (5/5)100% (1/1)
hashCode (): int 100% (1/1)100% (66/66)100% (1/1)
string (): Objects$ToStringHelper 100% (1/1)100% (51/51)100% (1/1)
toString (): String 100% (1/1)100% (4/4)100% (1/1)
     
class IpDetails$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class IpDetails$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
IpDetails$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
IpDetails$ConcreteBuilder (IpDetails$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): IpDetails$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.List;
23 
24import org.jclouds.javax.annotation.Nullable;
25 
26import com.google.common.base.Objects;
27import com.google.common.base.Objects.ToStringHelper;
28import com.google.common.collect.ImmutableList;
29 
30/**
31 * Represents detailed information about an IP address.
32 */
33public class IpDetails {
34 
35   public static Builder<?> builder() {
36      return new ConcreteBuilder();
37   }
38 
39   public Builder<?> toBuilder() {
40      return new ConcreteBuilder().fromIpDetails(this);
41   }
42 
43   public abstract static class Builder<T extends Builder<T>> {
44      protected abstract T self();
45 
46      protected String datacenter;
47      protected int ipversion;
48      protected String ptr;
49      protected String platform;
50      protected String address;
51      protected String netmask;
52      protected String broadcast;
53      protected String gateway;
54      protected List<String> nameServers = ImmutableList.of();
55      protected String serverId;
56      protected Cost cost;
57      protected boolean reserved;
58 
59      /**
60       * @see IpDetails#getDatacenter()
61       */
62      public T datacenter(String datacenter) {
63         this.datacenter = checkNotNull(datacenter, "datacenter");
64         return self();
65      }
66 
67      protected T version(int ipversion) {
68         this.ipversion = ipversion;
69         return self();
70      }
71 
72      /*
73      * @see IpDetails#getVersion()
74      */
75      public T version4() {
76         return version(4);
77      }
78 
79      /*
80      * @see IpDetails#getVersion()
81      */
82      public T version6() {
83         return version(6);
84      }
85 
86      /**
87       * @see IpDetails#getPtr()
88       */
89      public T ptr(String ptr) {
90         this.ptr = checkNotNull(ptr, "ptr");
91         return self();
92      }
93 
94      /**
95       * @see IpDetails#getPlatform()
96       */
97      public T platform(String platform) {
98         this.platform = checkNotNull(platform, "platform");
99         return self();
100      }
101 
102      /**
103       * @see IpDetails#getAddress()
104       */
105      public T address(String address) {
106         this.address = address;
107         return self();
108      }
109 
110      /**
111       * @see IpDetails#getNetmask()
112       */
113      public T netmask(String netmask) {
114         this.netmask = netmask;
115         return self();
116      }
117 
118      /**
119       * @see IpDetails#getBroadcast()
120       */
121      public T broadcast(String broadcast) {
122         this.broadcast = broadcast;
123         return self();
124      }
125 
126      /**
127       * @see IpDetails#getGateway()
128       */
129      public T gateway(String gateway) {
130         this.gateway = gateway;
131         return self();
132      }
133 
134      /**
135       * @see IpDetails#getNameServers()
136       */
137      public T nameServers(List<String> nameservers) {
138         this.nameServers = ImmutableList.copyOf(checkNotNull(nameservers, "nameServers"));
139         return self();
140      }
141 
142      public T nameServers(String... in) {
143         return nameServers(ImmutableList.copyOf(in));
144      }
145 
146      /**
147       * @see IpDetails#getServerId()
148       */
149      public T serverId(String serverId) {
150         this.serverId = serverId;
151         return self();
152      }
153 
154      /**
155       * @see IpDetails#getCost()
156       */
157      public T cost(Cost cost) {
158         this.cost = cost;
159         return self();
160      }
161 
162      /**
163       * @see IpDetails#isReserved()
164       */
165      public T reserved(boolean reserved) {
166         this.reserved = reserved;
167         return self();
168      }
169 
170      public IpDetails build() {
171         return new IpDetails(datacenter, ipversion, ptr, platform, address, netmask, broadcast, gateway, nameServers,
172               serverId, cost, new GleSYSBoolean(reserved));
173      }
174 
175      public T fromIpDetails(IpDetails in) {
176         return this.datacenter(in.getDatacenter())
177               .version(in.getVersion())
178               .ptr(in.getPtr())
179               .platform(in.getPlatform())
180               .address(in.getAddress())
181               .netmask(in.getNetmask())
182               .broadcast(in.getBroadcast())
183               .gateway(in.getGateway())
184               .nameServers(in.getNameServers())
185               .serverId(in.getServerId())
186               .cost(in.getCost())
187               .reserved(in.isReserved());
188      }
189   }
190 
191   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
192      @Override
193      protected ConcreteBuilder self() {
194         return this;
195      }
196   }
197 
198   private final String datacenter;
199   private final int version;
200   private final String ptr;
201   private final String platform;
202   private final String address;
203   private final String netmask;
204   private final String broadcast;
205   private final String gateway;
206   private final List<String> nameServers;
207   private final String serverId;
208   private final Cost cost;
209   private final boolean reserved;
210 
211   @ConstructorProperties({
212         "datacenter", "ipversion", "ptr", "platform", "ipaddress", "netmask", "broadcast", "gateway", "nameservers",
213         "serverid", "cost", "reserved"
214   })
215   protected IpDetails(String datacenter, int version, String ptr, String platform, String address,
216                       @Nullable String netmask, @Nullable String broadcast, @Nullable String gateway,
217                       List<String> nameServers, @Nullable String serverId, Cost cost, GleSYSBoolean reserved) {
218      this.datacenter = checkNotNull(datacenter, "datacenter");
219      this.version = checkNotNull(version, "version");
220      this.ptr = checkNotNull(ptr, "ptr");
221      this.platform = checkNotNull(platform, "platform");
222      this.address = address;
223      this.netmask = netmask;
224      this.broadcast = broadcast;
225      this.gateway = gateway;
226      this.nameServers = ImmutableList.copyOf(nameServers);
227      this.serverId = serverId;
228      this.cost = checkNotNull(cost, "cost");
229      this.reserved = checkNotNull(reserved, "reserved").getValue();
230   }
231 
232   public String getDatacenter() {
233      return this.datacenter;
234   }
235 
236   /**
237    * @return the IP version, ex. 4
238    */
239   public int getVersion() {
240      return this.version;
241   }
242 
243   public String getPtr() {
244      return this.ptr;
245   }
246 
247   public String getPlatform() {
248      return this.platform;
249   }
250 
251   public String getAddress() {
252      return this.address;
253   }
254 
255   @Nullable
256   public String getNetmask() {
257      return this.netmask;
258   }
259 
260   @Nullable
261   public String getBroadcast() {
262      return this.broadcast;
263   }
264 
265   @Nullable
266   public String getGateway() {
267      return this.gateway;
268   }
269 
270   public List<String> getNameServers() {
271      return this.nameServers;
272   }
273 
274   @Nullable
275   public String getServerId() {
276      return serverId;
277   }
278 
279   public Cost getCost() {
280      return cost;
281   }
282 
283   public boolean isReserved() {
284      return reserved;
285   }
286 
287   @Override
288   public int hashCode() {
289      return Objects.hashCode(datacenter, version, ptr, platform, address, netmask, broadcast, gateway, nameServers,
290            serverId, cost, reserved);
291   }
292 
293   @Override
294   public boolean equals(Object obj) {
295      if (this == obj) return true;
296      if (obj == null || getClass() != obj.getClass()) return false;
297      IpDetails that = IpDetails.class.cast(obj);
298      return Objects.equal(this.datacenter, that.datacenter)
299            && Objects.equal(this.version, that.version)
300            && Objects.equal(this.ptr, that.ptr)
301            && Objects.equal(this.platform, that.platform)
302            && Objects.equal(this.address, that.address)
303            && Objects.equal(this.netmask, that.netmask)
304            && Objects.equal(this.broadcast, that.broadcast)
305            && Objects.equal(this.gateway, that.gateway)
306            && Objects.equal(this.nameServers, that.nameServers)
307            && Objects.equal(this.serverId, that.serverId)
308            && Objects.equal(this.cost, that.cost)
309            && Objects.equal(this.reserved, that.reserved);
310   }
311 
312   protected ToStringHelper string() {
313      return Objects.toStringHelper("")
314            .add("datacenter", datacenter).add("ipversion", version).add("ptr", ptr).add("platform", platform)
315            .add("address", address).add("netmask", netmask).add("broadcast", broadcast).add("gateway", gateway)
316            .add("nameServers", nameServers).add("serverId", serverId).add("cost", cost).add("reserved", reserved);
317   }
318 
319   @Override
320   public String toString() {
321      return string().toString();
322   }
323 
324}

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