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

COVERAGE SUMMARY FOR SOURCE FILE [ObjectInfoImpl.java]

nameclass, %method, %block, %line, %
ObjectInfoImpl.java100% (2/2)92%  (23/25)78%  (207/267)69%  (42.8/62)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ObjectInfoImpl100% (1/1)87%  (13/15)68%  (128/188)57%  (25.8/45)
equals (Object): boolean 0%   (0/1)0%   (0/53)0%   (0/18)
getUri (): URI 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 100% (1/1)88%  (28/32)96%  (4.8/5)
ObjectInfoImpl (): void 100% (1/1)100% (3/3)100% (2/2)
ObjectInfoImpl (String, URI, String, byte [], Long, String, Date): void 100% (1/1)100% (24/24)100% (9/9)
builder (): ObjectInfoImpl$Builder 100% (1/1)100% (4/4)100% (1/1)
compareTo (ObjectInfo): int 100% (1/1)100% (6/6)100% (1/1)
getBytes (): Long 100% (1/1)100% (3/3)100% (1/1)
getContainer (): String 100% (1/1)100% (3/3)100% (1/1)
getContentType (): String 100% (1/1)100% (3/3)100% (1/1)
getHash (): byte [] 100% (1/1)100% (3/3)100% (1/1)
getLastModified (): Date 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
toBuilder (): ObjectInfoImpl$Builder 100% (1/1)100% (4/4)100% (1/1)
toString (): String 100% (1/1)100% (41/41)100% (1/1)
     
class ObjectInfoImpl$Builder100% (1/1)100% (10/10)100% (79/79)100% (17/17)
ObjectInfoImpl$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): ObjectInfoImpl 100% (1/1)100% (18/18)100% (1/1)
bytes (Long): ObjectInfoImpl$Builder 100% (1/1)100% (5/5)100% (2/2)
container (String): ObjectInfoImpl$Builder 100% (1/1)100% (5/5)100% (2/2)
contentType (String): ObjectInfoImpl$Builder 100% (1/1)100% (5/5)100% (2/2)
fromObjectInfo (ObjectInfo): ObjectInfoImpl$Builder 100% (1/1)100% (23/23)100% (1/1)
hash (byte []): ObjectInfoImpl$Builder 100% (1/1)100% (5/5)100% (2/2)
lastModified (Date): ObjectInfoImpl$Builder 100% (1/1)100% (5/5)100% (2/2)
name (String): ObjectInfoImpl$Builder 100% (1/1)100% (5/5)100% (2/2)
uri (URI): ObjectInfoImpl$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.openstack.swift.domain.internal;
20 
21import java.net.URI;
22import java.util.Arrays;
23import java.util.Date;
24 
25import org.jclouds.openstack.swift.domain.ObjectInfo;
26 
27import com.google.gson.annotations.SerializedName;
28 
29public class ObjectInfoImpl implements ObjectInfo {
30   public static Builder builder() {
31      return new Builder();
32   }
33 
34   public static class Builder {
35      private String name;
36      private String container;
37      private URI uri;
38      private byte[] hash;
39      private Long bytes;
40      private String contentType;
41      private Date lastModified;
42 
43      public Builder name(String name) {
44         this.name = name;
45         return this;
46      }
47 
48      public Builder container(String container) {
49         this.container = container;
50         return this;
51      }
52 
53      public Builder uri(URI uri) {
54         this.uri = uri;
55         return this;
56      }
57 
58      public Builder hash(byte[] hash) {
59         this.hash = hash;
60         return this;
61      }
62 
63      public Builder bytes(Long bytes) {
64         this.bytes = bytes;
65         return this;
66      }
67 
68      public Builder contentType(String contentType) {
69         this.contentType = contentType;
70         return this;
71      }
72 
73      public Builder lastModified(Date lastModified) {
74         this.lastModified = lastModified;
75         return this;
76      }
77 
78      public ObjectInfoImpl build() {
79         return new ObjectInfoImpl(name, uri, container, hash, bytes, contentType, lastModified);
80      }
81 
82      public Builder fromObjectInfo(ObjectInfo in) {
83         return name(in.getName()).container(in.getContainer()).uri(uri).hash(in.getHash()).bytes(in.getBytes())
84                  .contentType(in.getContentType()).lastModified(in.getLastModified());
85      }
86   }
87 
88   private String name;
89   private String container;
90   private URI uri;
91   private byte[] hash;
92   private Long bytes;
93   @SerializedName("content_type")
94   private String contentType;
95   @SerializedName("last_modified")
96   private Date lastModified;
97 
98   public ObjectInfoImpl(String name, URI uri, String container, byte[] hash, Long bytes, String contentType,
99            Date lastModified) {
100      this.name = name;
101      this.container = container;
102      this.uri = uri;
103      this.hash = hash;
104      this.bytes = bytes;
105      this.contentType = contentType;
106      this.lastModified = lastModified;
107   }
108 
109   ObjectInfoImpl() {
110 
111   }
112 
113   /**
114    * {@inheritDoc}
115    */
116   @Override
117   public String getName() {
118      return name;
119   }
120 
121   /**
122    * {@inheritDoc}
123    */
124   @Override
125   public String getContainer() {
126      return container;
127   }
128 
129   /**
130    * {@inheritDoc}
131    */
132   @Override
133   public URI getUri() {
134      return uri;
135   }
136 
137   /**
138    * {@inheritDoc}
139    */
140   @Override
141   public byte[] getHash() {
142      return hash;
143   }
144 
145   /**
146    * {@inheritDoc}
147    */
148   @Override
149   public Long getBytes() {
150      return bytes;
151   }
152 
153   /**
154    * {@inheritDoc}
155    */
156   @Override
157   public String getContentType() {
158      return contentType;
159   }
160 
161   /**
162    * {@inheritDoc}
163    */
164   @Override
165   public Date getLastModified() {
166      return lastModified;
167   }
168 
169   @Override
170   public int hashCode() {
171      final int prime = 31;
172      int result = 1;
173      result = prime * result + ((container == null) ? 0 : container.hashCode());
174      result = prime * result + ((name == null) ? 0 : name.hashCode());
175      return result;
176   }
177 
178   @Override
179   public boolean equals(Object obj) {
180      if (this == obj)
181         return true;
182      if (obj == null)
183         return false;
184      if (getClass() != obj.getClass())
185         return false;
186      ObjectInfoImpl other = (ObjectInfoImpl) obj;
187      if (container == null) {
188         if (other.container != null)
189            return false;
190      } else if (!container.equals(other.container))
191         return false;
192      if (name == null) {
193         if (other.name != null)
194            return false;
195      } else if (!name.equals(other.name))
196         return false;
197      return true;
198   }
199 
200   @Override
201   public String toString() {
202      return String.format("[name=%s, container=%s, uri=%s, bytes=%s, contentType=%s, lastModified=%s, hash=%s]", name,
203               container, uri, bytes, contentType, lastModified, Arrays.toString(hash));
204   }
205 
206   public Builder toBuilder() {
207      return builder().fromObjectInfo(this);
208   }
209 
210   @Override
211   public int compareTo(ObjectInfo o) {
212      return name.compareTo(o.getName());
213   }
214 
215}

[all classes][org.jclouds.openstack.swift.domain.internal]
EMMA 2.0.5312 (C) Vladimir Roubtsov