001    package org.apache.archiva.metadata.model;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import javax.xml.bind.annotation.XmlRootElement;
023    import java.io.Serializable;
024    
025    /**
026     * A description of a particular license used by a project.
027     */
028    @XmlRootElement(name = "license")
029    public class License
030        implements Serializable
031    {
032        /**
033         * The name of the license.
034         */
035        private String name;
036    
037        /**
038         * The URL of the license text.
039         */
040        private String url;
041    
042        public License( String name, String url )
043        {
044            this.name = name;
045            this.url = url;
046        }
047    
048        public License()
049        {
050        }
051    
052        public String getName()
053        {
054            return name;
055        }
056    
057        public void setName( String name )
058        {
059            this.name = name;
060        }
061    
062        public String getUrl()
063        {
064            return url;
065        }
066    
067        public void setUrl( String url )
068        {
069            this.url = url;
070        }
071    
072        @Override
073        public boolean equals( Object o )
074        {
075            if ( this == o )
076            {
077                return true;
078            }
079            if ( o == null || getClass() != o.getClass() )
080            {
081                return false;
082            }
083    
084            License license = (License) o;
085    
086            if ( name != null ? !name.equals( license.name ) : license.name != null )
087            {
088                return false;
089            }
090            if ( url != null ? !url.equals( license.url ) : license.url != null )
091            {
092                return false;
093            }
094    
095            return true;
096        }
097    
098        @Override
099        public int hashCode()
100        {
101            int result = name != null ? name.hashCode() : 0;
102            result = 31 * result + ( url != null ? url.hashCode() : 0 );
103            return result;
104        }
105    
106        @Override
107        public String toString()
108        {
109            return "License{" + "name='" + name + '\'' + ", url='" + url + '\'' + '}';
110        }
111    }