001    // Copyright Aug 2, 2006 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    package org.apache.tapestry.html;
015    
016    /**
017     * Defines a relationship between two documents.
018     * 
019     * @author Andreas Andreou
020     * @since 4.1.1 
021     */
022    public class RelationBean
023    {
024        /** The target URL of the resource. */
025        private String _href;
026        /** Specifies on what device the document will be displayed. */
027        private String _media;
028        /** Defines the relationship between the current document and the targeted document. */
029        private String _rel;
030        /** Defines the relationship between the targeted document and the current document. */
031        private String _rev;
032        /** Specifies the MIME type of the target URL. */
033        private String _type;
034        /** Title of the relation. */
035        private String _title;
036        
037        public RelationBean()
038        {        
039        }
040        
041        public String getHref()
042        {
043            return _href;
044        }
045        
046        public void setHref(String href)
047        {
048            _href = href;
049        }
050        
051        public String getMedia()
052        {
053            return _media;
054        }
055        
056        public void setMedia(String media)
057        {
058            _media = media;
059        }
060        
061        public String getRel()
062        {
063            return _rel;
064        }
065        
066        public void setRel(String rel)
067        {
068            _rel = rel;
069        }
070        
071        public String getRev()
072        {
073            return _rev;
074        }
075        
076        public void setRev(String rev)
077        {
078            _rev = rev;
079        }
080        
081        public String getType()
082        {
083            return _type;
084        }
085        
086        public void setType(String type)
087        {
088            _type = type;
089        }
090        
091        public String getTitle()
092        {
093            return _title;
094        }
095        
096        public void setTitle(String title)
097        {
098            _title = title;
099        }
100    
101        public int hashCode()
102        {
103            final int prime = 31;
104            int result = 1;
105            result = prime * result + ((_href == null) ? 0 : _href.hashCode());
106            result = prime * result + ((_media == null) ? 0 : _media.hashCode());
107            result = prime * result + ((_rel == null) ? 0 : _rel.hashCode());
108            result = prime * result + ((_rev == null) ? 0 : _rev.hashCode());
109            result = prime * result + ((_title == null) ? 0 : _title.hashCode());
110            result = prime * result + ((_type == null) ? 0 : _type.hashCode());
111            return result;
112        }
113    
114        public boolean equals(Object obj)
115        {
116            if (this == obj) return true;
117            if (obj == null) return false;
118            if (getClass() != obj.getClass()) return false;
119            final RelationBean other = (RelationBean) obj;
120            if (_href == null) {
121                if (other._href != null) return false;
122            } else if (!_href.equals(other._href)) return false;
123            if (_media == null) {
124                if (other._media != null) return false;
125            } else if (!_media.equals(other._media)) return false;
126            if (_rel == null) {
127                if (other._rel != null) return false;
128            } else if (!_rel.equals(other._rel)) return false;
129            if (_rev == null) {
130                if (other._rev != null) return false;
131            } else if (!_rev.equals(other._rev)) return false;
132            if (_title == null) {
133                if (other._title != null) return false;
134            } else if (!_title.equals(other._title)) return false;
135            if (_type == null) {
136                if (other._type != null) return false;
137            } else if (!_type.equals(other._type)) return false;
138            return true;
139        }  
140        
141        
142    }