001: /*
002: * Copyright 2004 Sun Microsystems, Inc.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: *
016: */
017: package com.sun.syndication.feed.rss;
018:
019: import com.sun.syndication.feed.impl.ObjectBean;
020:
021: import java.io.Serializable;
022:
023: /**
024: * Bean for item enclosures of RSS feeds.
025: * <p>
026: * @author Alejandro Abdelnur
027: *
028: */
029: public class Enclosure implements Cloneable, Serializable {
030: private ObjectBean _objBean;
031: private String _url;
032: private long _length;
033: private String _type;
034:
035: /**
036: * Default constructor. All properties are set to <b>null</b>.
037: * <p>
038: *
039: */
040: public Enclosure() {
041: _objBean = new ObjectBean(this .getClass(), this );
042: }
043:
044: /**
045: * Creates a deep 'bean' clone of the object.
046: * <p>
047: * @return a clone of the object.
048: * @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
049: *
050: */
051: public Object clone() throws CloneNotSupportedException {
052: return _objBean.clone();
053: }
054:
055: /**
056: * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
057: * <p>
058: * @param other he reference object with which to compare.
059: * @return <b>true</b> if 'this' object is equal to the 'other' object.
060: *
061: */
062: public boolean equals(Object other) {
063: return _objBean.equals(other);
064: }
065:
066: /**
067: * Returns a hashcode value for the object.
068: * <p>
069: * It follows the contract defined by the Object hashCode() method.
070: * <p>
071: * @return the hashcode of the bean object.
072: *
073: */
074: public int hashCode() {
075: return _objBean.hashCode();
076: }
077:
078: /**
079: * Returns the String representation for the object.
080: * <p>
081: * @return String representation for the object.
082: *
083: */
084: public String toString() {
085: return _objBean.toString();
086: }
087:
088: /**
089: * Returns the enclosure URL.
090: * <p>
091: * @return the enclosure URL, <b>null</b> if none.
092: *
093: */
094: public String getUrl() {
095: return _url;
096: }
097:
098: /**
099: * 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: }
|