1 /* 2 * Copyright 2004 Sun Microsystems, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 package com.sun.syndication.feed.rss; 18 19 import com.sun.syndication.feed.impl.ObjectBean; 20 21 import java.io.Serializable; 22 23 /** 24 * Bean for item enclosures of RSS feeds. 25 * <p> 26 * @author Alejandro Abdelnur 27 * 28 */ 29 public class Enclosure implements Cloneable,Serializable { 30 private ObjectBean _objBean; 31 private String _url; 32 private long _length; 33 private String _type; 34 35 /** 36 * Default constructor. All properties are set to <b>null</b>. 37 * <p> 38 * 39 */ 40 public Enclosure() { 41 _objBean = new ObjectBean(this.getClass(),this); 42 } 43 44 /** 45 * Creates a deep 'bean' clone of the object. 46 * <p> 47 * @return a clone of the object. 48 * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned. 49 * 50 */ 51 public Object clone() throws CloneNotSupportedException { 52 return _objBean.clone(); 53 } 54 55 /** 56 * Indicates whether some other object is "equal to" this one as defined by the Object equals() method. 57 * <p> 58 * @param other he reference object with which to compare. 59 * @return <b>true</b> if 'this' object is equal to the 'other' object. 60 * 61 */ 62 public boolean equals(Object other) { 63 return _objBean.equals(other); 64 } 65 66 /** 67 * Returns a hashcode value for the object. 68 * <p> 69 * It follows the contract defined by the Object hashCode() method. 70 * <p> 71 * @return the hashcode of the bean object. 72 * 73 */ 74 public int hashCode() { 75 return _objBean.hashCode(); 76 } 77 78 /** 79 * Returns the String representation for the object. 80 * <p> 81 * @return String representation for the object. 82 * 83 */ 84 public String toString() { 85 return _objBean.toString(); 86 } 87 88 /** 89 * Returns the enclosure URL. 90 * <p> 91 * @return the enclosure URL, <b>null</b> if none. 92 * 93 */ 94 public String getUrl() { 95 return _url; 96 } 97 98 /** 99 * Sets the enclosure URL. 100 * <p> 101 * @param url the enclosure URL to set, <b>null</b> if none. 102 * 103 */ 104 public void setUrl(String url) { 105 _url = url; 106 } 107 108 /** 109 * Returns the enclosure length. 110 * <p> 111 * @return the enclosure length, <b>null</b> if none. 112 * 113 */ 114 public long getLength() { 115 return _length; 116 } 117 118 /** 119 * Sets the enclosure length. 120 * <p> 121 * @param length the enclosure length to set, <b>null</b> if none. 122 * 123 */ 124 public void setLength(long length) { 125 _length = length; 126 } 127 128 /** 129 * Returns the enclosure type. 130 * <p> 131 * @return the enclosure type, <b>null</b> if none. 132 * 133 */ 134 public String getType() { 135 return _type; 136 } 137 138 /** 139 * Sets the enclosure type. 140 * <p> 141 * @param type the enclosure type to set, <b>null</b> if none. 142 * 143 */ 144 public void setType(String type) { 145 _type = type; 146 } 147 148 }