Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
../../../../img/srcFileCovDistChart9.png 23% of files have more coverage
23   161   15   2,09
6   55   0,65   11
11     1,36  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  Attachment       Line # 41 23 0% 15 6 85% 0.85
 
  (8)
 
1    /*
2    * Copyright (c) 2003-2006, Simon Brown
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * - Redistributions of source code must retain the above copyright
9    * notice, this list of conditions and the following disclaimer.
10    *
11    * - Redistributions in binary form must reproduce the above copyright
12    * notice, this list of conditions and the following disclaimer in
13    * the documentation and/or other materials provided with the
14    * distribution.
15    *
16    * - Neither the name of Pebble nor the names of its contributors may
17    * be used to endorse or promote products derived from this software
18    * without specific prior written permission.
19    *
20    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23    * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    * POSSIBILITY OF SUCH DAMAGE.
31    */
32    package net.sourceforge.pebble.domain;
33   
34   
35    /**
36    * Represents a blog entry attachment (such as that used within an RSS
37    * enclosure).
38    *
39    * @author Simon Brown
40    */
 
41    public class Attachment implements Cloneable {
42   
43    /** the URL of the attachment */
44    private String url;
45   
46    /** the content size (length in bytes) */
47    private long size;
48   
49    /** the content type */
50    private String type;
51   
52    /**
53    * Default, no args constructor.
54    */
 
55  4 toggle public Attachment() {
56    }
57   
58    /**
59    * Creates an instance with the specified properties.
60    *
61    * @param url a URL as a String
62    * @param size the size in bytes
63    * @param type a content type as a String
64    */
 
65  8 toggle public Attachment(String url, long size, String type) {
66  8 setUrl(url);
67  8 setSize(size);
68  8 setType(type);
69    }
70   
71    /**
72    * Gets the URL.
73    *
74    * @return the URL as a String
75    */
 
76  10 toggle public String getUrl() {
77  10 return url;
78    }
79   
80    /**
81    * Sets the URL.
82    *
83    * @param url a URL as a String
84    */
 
85  14 toggle public void setUrl(String url) {
86  14 this.url = url;
87    }
88   
89    /**
90    * Gets the size in bytes.
91    *
92    * @return the size of the attachement in bytes
93    */
 
94  2 toggle public long getSize() {
95  2 return size;
96    }
97   
98    /**
99    * Sets the size of the attachement in bytes.
100    *
101    * @param size the size in bytes
102    */
 
103  12 toggle public void setSize(long size) {
104  12 this.size = size;
105    }
106   
107    /**
108    * Gets the content type.
109    *
110    * @return a MIME type as a String
111    */
 
112  2 toggle public String getType() {
113  2 return type;
114    }
115   
116    /**
117    * Sets the content type.
118    *
119    * @param type a content type as a String
120    */
 
121  12 toggle public void setType(String type) {
122  12 this.type = type;
123    }
124   
 
125  12 toggle public boolean equals(Object o) {
126  12 if (this == o) {
127  6 return true;
128    }
129   
130  6 if (!(o instanceof Attachment)) {
131  0 return false;
132    }
133   
134  6 final Attachment attachment = (Attachment) o;
135  6 if (url == null || url.length() == 0) {
136  0 return attachment.url == null || attachment.url.length() == 0;
137    } else {
138  6 return url.equals(attachment.url);
139    }
140    }
141   
 
142  0 toggle public int hashCode() {
143  0 return url.hashCode();
144    }
145   
146    /**
147    * Creates and returns a copy of this object.
148    *
149    * @return a clone of this instance.
150    * @see Cloneable
151    */
 
152  2 toggle public Object clone() {
153  2 Attachment attachment = new Attachment();
154  2 attachment.setUrl(url);
155  2 attachment.setSize(size);
156  2 attachment.setType(type);
157   
158  2 return attachment;
159    }
160   
161    }