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

COVERAGE SUMMARY FOR SOURCE FILE [Password.java]

nameclass, %method, %block, %line, %
Password.java100% (2/2)71%  (12/17)66%  (108/163)64%  (25/39)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Password100% (1/1)64%  (7/11)64%  (77/121)55%  (16/29)
compareTo (Password): int 0%   (0/1)0%   (0/10)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/28)0%   (0/10)
getId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
toBuilder (): Password$Builder 0%   (0/1)0%   (0/3)0%   (0/1)
Password (): void 100% (1/1)100% (6/6)100% (3/3)
Password (int, String, String): void 100% (1/1)100% (26/26)100% (6/6)
builder (): Password$Builder 100% (1/1)100% (4/4)100% (1/1)
getPassword (): String 100% (1/1)100% (3/3)100% (1/1)
getUsername (): String 100% (1/1)100% (3/3)100% (1/1)
hashCode (): int 100% (1/1)100% (18/18)100% (4/4)
toString (): String 100% (1/1)100% (17/17)100% (1/1)
     
class Password$Builder100% (1/1)83%  (5/6)74%  (31/42)90%  (9/10)
fromPassword (Password): Password$Builder 0%   (0/1)0%   (0/11)0%   (0/1)
Password$Builder (): void 100% (1/1)100% (6/6)100% (2/2)
build (): Password 100% (1/1)100% (10/10)100% (1/1)
id (int): Password$Builder 100% (1/1)100% (5/5)100% (2/2)
password (String): Password$Builder 100% (1/1)100% (5/5)100% (2/2)
username (String): Password$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.Preconditions.checkNotNull;
22import static com.google.common.base.Strings.emptyToNull;
23 
24/**
25 *
26 * Contains a password for a specific software component instance
27 *
28 * @author Jason King
29 * @see <a href= "http://sldn.softlayer.com/reference/datatypes/SoftLayer_Software_Component_Password"
30 *      />
31 */
32public class Password implements Comparable<Password> {
33   public static Builder builder() {
34      return new Builder();
35   }
36 
37   public static class Builder {
38      private int id = -1;
39      private String username;
40      private String password;
41 
42      public Builder id(int id) {
43         this.id = id;
44         return this;
45      }
46 
47      public Builder username(String username) {
48         this.username = username;
49         return this;
50      }
51 
52      public Builder password(String password) {
53         this.password = password;
54         return this;
55      }
56 
57      public Password build() {
58         return new Password(id, username, password);
59      }
60 
61      public static Builder fromPassword(Password in) {
62         return Password.builder().id(in.getId())
63                                 .username(in.getUsername())
64                                 .password(in.getPassword());
65      }
66   }
67 
68   private int id = -1;
69   private String username;
70   private String password;
71 
72   // for deserializer
73   Password() {
74 
75   }
76 
77   public Password(int id, String username, String password) {
78      this.id = id;
79      this.username = checkNotNull(emptyToNull(username),"username cannot be null or empty:"+username);
80      this.password = password;
81   }
82 
83    @Override
84   public int compareTo(Password arg0) {
85      return new Integer(id).compareTo(arg0.getId());
86   }
87 
88   /**
89    * @return An id number for this specific username/password pair.
90    */
91   public int getId() {
92      return id;
93   }
94 
95   /**
96    * @return The username part of the username/password pair.
97    */
98   public String getUsername() {
99      return username;
100   }
101 
102   /**
103    * @return The password part of the username/password pair.
104    */
105   public String getPassword() {
106      return password;
107   }
108 
109   public Builder toBuilder() {
110      return Builder.fromPassword(this);
111   }
112 
113   @Override
114   public int hashCode() {
115      final int prime = 31;
116      int result = 1;
117      result = prime * result + (id ^ (id >>> 32));
118      return result;
119   }
120 
121   @Override
122   public boolean equals(Object obj) {
123      if (this == obj)
124         return true;
125      if (obj == null)
126         return false;
127      if (getClass() != obj.getClass())
128         return false;
129      Password other = (Password) obj;
130      if (id != other.id)
131         return false;
132      return true;
133   }
134 
135   @Override
136   public String toString() {
137      return "Password [id=" + id + ", username=" + username + ", password=**********]";
138   }
139   
140   
141}

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