001/** 002 * Copyright 2011 Bill Brown 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 */ 016package com.colorfulsoftware.rss; 017 018import java.io.Serializable; 019 020/** 021 * <p> 022 * From the <a href="http://cyber.law.harvard.edu/rss/rss.html">RSS 2.0 023 * specification</a>... 024 * </p> 025 * <p> 026 * A URL that points to the documentation for the format used in the RSS file. 027 * It's probably a pointer to this page. It's for people who might stumble 028 * across an RSS file on a Web server 25 years from now and wonder what it is. 029 * </p> 030 * 031 * @author Bill Brown 032 * 033 */ 034public class Docs implements Serializable { 035 036 private static final long serialVersionUID = 1840987541596737383L; 037 038 private final String docs; 039 040 Docs(String docs) throws RSSpectException { 041 if (docs == null || docs.equals("")) { 042 throw new RSSpectException("docs SHOULD NOT be blank."); 043 } 044 this.docs = docs; 045 } 046 047 Docs(Docs docs) { 048 this.docs = docs.docs; 049 } 050 051 /** 052 * @return the documentation information for the rss format in url form. 053 */ 054 public String getDocs() { 055 return docs; 056 } 057 058 /** 059 * Shows the contents of the <docs> element. 060 */ 061 @Override 062 public String toString() { 063 return "<docs>" + docs + "</docs>"; 064 } 065 066 @Override 067 public boolean equals(Object obj) { 068 if (obj == this) { 069 return true; 070 } 071 if (!(obj instanceof Docs)) { 072 return false; 073 } 074 return this.toString().equals(obj.toString()); 075 } 076 077 @Override public int hashCode() { 078 return toString().hashCode(); 079 } 080 081}