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

COVERAGE SUMMARY FOR SOURCE FILE [Archive.java]

nameclass, %method, %block, %line, %
Archive.java75%  (3/4)57%  (12/21)61%  (136/222)70%  (22.3/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Archive100% (1/1)27%  (3/11)52%  (77/149)54%  (10.3/19)
getFreeSize (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getTotalSize (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getUsername (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/25)0%   (0/1)
isLocked (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
string (): Objects$ToStringHelper 0%   (0/1)0%   (0/19)0%   (0/1)
toBuilder (): Archive$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)90%  (44/49)84%  (3.3/4)
Archive (String, String, String, GleSYSBoolean): void 100% (1/1)100% (28/28)100% (6/6)
builder (): Archive$Builder 100% (1/1)100% (5/5)100% (1/1)
     
class Archive$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class Archive$Builder100% (1/1)86%  (6/7)78%  (51/65)91%  (10/11)
fromArchive (Archive): Archive$Builder 0%   (0/1)0%   (0/14)0%   (0/1)
Archive$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): Archive 100% (1/1)100% (15/15)100% (1/1)
freeSize (String): Archive$Builder 100% (1/1)100% (9/9)100% (2/2)
locked (boolean): Archive$Builder 100% (1/1)100% (6/6)100% (2/2)
totalSize (String): Archive$Builder 100% (1/1)100% (9/9)100% (2/2)
username (String): Archive$Builder 100% (1/1)100% (9/9)100% (2/2)
     
class Archive$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
Archive$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
Archive$ConcreteBuilder (Archive$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): Archive$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 * Information about an archive
28 *
29 * @author Adam Lowe
30 * @see <a href= "https://customer.glesys.com/api.php?a=doc#archive_list" />
31 */
32public class Archive {
33 
34   public static Builder<?> builder() {
35      return new ConcreteBuilder();
36   }
37 
38   public Builder<?> toBuilder() {
39      return new ConcreteBuilder().fromArchive(this);
40   }
41 
42   public abstract static class Builder<T extends Builder<T>> {
43      protected abstract T self();
44 
45      protected String username;
46      protected String totalSize;
47      protected String freeSize;
48      protected boolean locked;
49 
50      /**
51       * @see Archive#getUsername()
52       */
53      public T username(String username) {
54         this.username = checkNotNull(username, "username");
55         return self();
56      }
57 
58      /**
59       * @see Archive#getTotalSize()
60       */
61      public T totalSize(String totalSize) {
62         this.totalSize = checkNotNull(totalSize, "totalSize");
63         return self();
64      }
65 
66      /**
67       * @see Archive#getFreeSize()
68       */
69      public T freeSize(String freeSize) {
70         this.freeSize = checkNotNull(freeSize, "freeSize");
71         return self();
72      }
73 
74      /**
75       * @see Archive#isLocked()
76       */
77      public T locked(boolean locked) {
78         this.locked = locked;
79         return self();
80      }
81 
82      public Archive build() {
83         return new Archive(username, totalSize, freeSize, new GleSYSBoolean(locked));
84      }
85 
86      public T fromArchive(Archive in) {
87         return this
88               .username(in.getUsername())
89               .totalSize(in.getTotalSize())
90               .freeSize(in.getFreeSize())
91               .locked(in.isLocked());
92      }
93   }
94 
95   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
96      @Override
97      protected ConcreteBuilder self() {
98         return this;
99      }
100   }
101 
102   private final String username;
103   private final String totalSize;
104   private final String freeSize;
105   private final boolean locked;
106 
107   @ConstructorProperties({
108         "username", "sizetotal", "sizefree", "locked"
109   })
110   protected Archive(String username, String totalSize, String freeSize, GleSYSBoolean locked) {
111      this.username = checkNotNull(username, "username");
112      this.totalSize = checkNotNull(totalSize, "totalSize");
113      this.freeSize = checkNotNull(freeSize, "freeSize");
114      this.locked = checkNotNull(locked, "locked").getValue();
115   }
116 
117   /**
118    * @return the name (username) of the archive
119    */
120   public String getUsername() {
121      return this.username;
122   }
123 
124   /**
125    * @return the total size of the archive, ex. "10 GB"
126    */
127   public String getTotalSize() {
128      return this.totalSize;
129   }
130 
131   /**
132    * @return the free space left of the archive
133    */
134   public String getFreeSize() {
135      return this.freeSize;
136   }
137 
138   /**
139    * @return true if the archive is locked
140    */
141   public boolean isLocked() {
142      return this.locked;
143   }
144 
145   @Override
146   public int hashCode() {
147      return Objects.hashCode(username, totalSize, freeSize, locked);
148   }
149 
150   @Override
151   public boolean equals(Object obj) {
152      if (this == obj) return true;
153      if (obj == null || getClass() != obj.getClass()) return false;
154      Archive that = Archive.class.cast(obj);
155      return Objects.equal(this.username, that.username)
156            && Objects.equal(this.totalSize, that.totalSize)
157            && Objects.equal(this.freeSize, that.freeSize)
158            && Objects.equal(this.locked, that.locked);
159   }
160 
161   protected ToStringHelper string() {
162      return Objects.toStringHelper("")
163            .add("username", username).add("totalSize", totalSize).add("freeSize", freeSize).add("locked", locked);
164   }
165 
166   @Override
167   public String toString() {
168      return string().toString();
169   }
170 
171}

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