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 * The &lt;webMaster> element.
023 * </p>
024 * <p>
025 * From the <a href="http://cyber.law.harvard.edu/rss/rss.html">RSS 2.0
026 * specification</a>...
027 * </p>
028 * <p>
029 * Email address for person responsible for technical issues relating to
030 * channel.
031 * </p>
032 * 
033 * @author Bill Brown
034 * 
035 */
036public class WebMaster implements Serializable {
037
038        /**
039         * 
040         */
041        private static final long serialVersionUID = -2326329055869744204L;
042
043        private final String webMaster;
044
045        WebMaster(String webMaster) throws RSSpectException {
046                if (webMaster == null || webMaster.equals("")) {
047                        throw new RSSpectException("webMaster SHOULD NOT be blank.");
048                }
049                this.webMaster = webMaster;
050        }
051
052        WebMaster(WebMaster webMaster) {
053                this.webMaster = webMaster.webMaster;
054        }
055
056        /**
057         * @return the web master.
058         */
059        public String getWebMaster() {
060                return webMaster;
061        }
062
063        /**
064         * Shows the contents of the &lt;webMaster> element.
065         */
066        @Override
067        public String toString() {
068                return "<webMaster>" + webMaster + "</webMaster>";
069        }
070        
071        @Override
072        public boolean equals(Object obj) {
073                if (obj == this) {
074                        return true;
075                }
076                if (!(obj instanceof WebMaster)) {
077                        return false;
078                }
079                return this.toString().equals(obj.toString());
080        }
081        
082        @Override public int hashCode() {
083                return toString().hashCode();
084        }
085}