EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.softlayer.domain]

COVERAGE SUMMARY FOR SOURCE FILE [Address.java]

nameclass, %method, %block, %line, %
Address.java100% (2/2)47%  (9/19)38%  (72/189)44%  (18.8/43)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Address100% (1/1)33%  (4/12)28%  (39/137)32%  (9.8/31)
Address (): void 0%   (0/1)0%   (0/6)0%   (0/3)
compareTo (Address): int 0%   (0/1)0%   (0/10)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/28)0%   (0/10)
getDescription (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/18)0%   (0/4)
toBuilder (): Address$Builder 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)
Address (int, String, String, String): void 100% (1/1)100% (29/29)100% (7/7)
builder (): Address$Builder 100% (1/1)100% (4/4)100% (1/1)
getCountry (): String 100% (1/1)100% (3/3)100% (1/1)
getState (): String 100% (1/1)100% (3/3)100% (1/1)
     
class Address$Builder100% (1/1)71%  (5/7)63%  (33/52)75%  (9/12)
fromAddress (Address): Address$Builder 0%   (0/1)0%   (0/14)0%   (0/1)
id (int): Address$Builder 0%   (0/1)0%   (0/5)0%   (0/2)
Address$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
build (): Address 100% (1/1)100% (12/12)100% (1/1)
country (String): Address$Builder 100% (1/1)100% (5/5)100% (2/2)
description (String): Address$Builder 100% (1/1)100% (5/5)100% (2/2)
state (String): Address$Builder 100% (1/1)100% (5/5)100% (2/2)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.softlayer.domain;
20 
21import static com.google.common.base.Strings.emptyToNull;
22import static com.google.common.base.Preconditions.checkNotNull;
23 
24/**
25 * 
26 * @author Jason King
27 * @see <a href= "http://sldn.softlayer.com/reference/datatypes/SoftLayer_Account_Address"
28 *      />
29 */
30public class Address implements Comparable<Address> {
31   public static Builder builder() {
32      return new Builder();
33   }
34 
35   public static class Builder {
36      private int id = -1;
37      private String country;
38      private String state;
39      private String description;
40 
41      public Builder id(int id) {
42         this.id = id;
43         return this;
44      }
45 
46      public Builder country(String country) {
47         this.country = country;
48         return this;
49      }
50 
51      public Builder state(String state) {
52         this.state = state;
53         return this;
54      }
55 
56      public Builder description(String description) {
57         this.description = description;
58         return this;
59      }
60 
61      public Address build() {
62         return new Address(id, country, state, description);
63      }
64 
65      public static Builder fromAddress(Address in) {
66         return Address.builder().id(in.getId())
67                                 .country(in.getCountry())
68                                 .state(in.getState())
69                                 .description(in.getDescription());
70      }
71   }
72 
73   private int id = -1;
74   private String country;
75   private String state;
76   private String description;
77 
78   // for deserializer
79   Address() {
80 
81   }
82 
83   public Address(int id, String country, String state, String description) {
84      this.id = id;
85      this.country = checkNotNull(emptyToNull(country),"country cannot be null or empty:"+country);
86      this.state = state;
87      this.description = description;
88   }
89 
90   @Override
91   public int compareTo(Address arg0) {
92      return new Integer(id).compareTo(arg0.getId());
93   }
94 
95   /**
96    * @return The unique id of the address.
97    */
98   public int getId() {
99      return id;
100   }
101 
102   /**
103    * @return The country of the address.
104    */
105   public String getCountry() {
106      return country;
107   }
108 
109   /**
110    * @return The state of the address.
111    */
112   public String getState() {
113      return state;
114   }
115 
116   /**
117    * @return The description of the address.
118    */
119   public String getDescription() {
120      return description;
121   }
122 
123   public Builder toBuilder() {
124      return Builder.fromAddress(this);
125   }
126 
127   @Override
128   public int hashCode() {
129      final int prime = 31;
130      int result = 1;
131      result = prime * result + (id ^ (id >>> 32));
132      return result;
133   }
134 
135   @Override
136   public boolean equals(Object obj) {
137      if (this == obj)
138         return true;
139      if (obj == null)
140         return false;
141      if (getClass() != obj.getClass())
142         return false;
143      Address other = (Address) obj;
144      if (id != other.id)
145         return false;
146      return true;
147   }
148 
149   @Override
150   public String toString() {
151      return "[id=" + id + ", country=" + country + ", state=" + state + ", description=" + description + "]";
152   }
153   
154   
155}

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