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;managingEditor> 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 editorial content.
030 * </p>
031 * 
032 * @author Bill Brown
033 * 
034 */
035public class ManagingEditor implements Serializable {
036
037        private static final long serialVersionUID = -6599327589073455199L;
038
039        private final String managingEditor;
040
041        ManagingEditor(String managingEditor) throws RSSpectException {
042                if (managingEditor == null || managingEditor.equals("")) {
043                        throw new RSSpectException("managingEditor SHOULD NOT be blank.");
044                }
045                this.managingEditor = managingEditor;
046        }
047
048        ManagingEditor(ManagingEditor managingEditor) {
049                this.managingEditor = managingEditor.managingEditor;
050        }
051
052        /**
053         * @return the managing editor.
054         */
055        public String getManagingEditor() {
056                return managingEditor;
057        }
058
059        /**
060         * Shows the contents of the &lt;managingEditor> element.
061         */
062        @Override
063        public String toString() {
064                return "<managingEditor>" + managingEditor + "</managingEditor>";
065        }
066        
067        @Override
068        public boolean equals(Object obj) {
069                if (obj == this) {
070                        return true;
071                }
072                if (!(obj instanceof ManagingEditor)) {
073                        return false;
074                }
075                return this.toString().equals(obj.toString());
076        }
077        
078        @Override public int hashCode() {
079                return toString().hashCode();
080        }
081}