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 [MutableObjectInfoWithMetadataImpl.java]

nameclass, %method, %block, %line, %
MutableObjectInfoWithMetadataImpl.java100% (1/1)80%  (16/20)31%  (61/198)50%  (25/50)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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