001package 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
022import javax.xml.bind.annotation.XmlRootElement;
023import java.io.Serializable;
024
025/**
026 * A description of a particular license used by a project.
027 */
028@XmlRootElement(name = "license")
029public 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        // no op
051    }
052
053    public String getName()
054    {
055        return name;
056    }
057
058    public void setName( String name )
059    {
060        this.name = name;
061    }
062
063    public String getUrl()
064    {
065        return url;
066    }
067
068    public void setUrl( String url )
069    {
070        this.url = url;
071    }
072
073    @Override
074    public boolean equals( Object o )
075    {
076        if ( this == o )
077        {
078            return true;
079        }
080        if ( o == null || getClass() != o.getClass() )
081        {
082            return false;
083        }
084
085        License license = (License) o;
086
087        if ( name != null ? !name.equals( license.name ) : license.name != null )
088        {
089            return false;
090        }
091        if ( url != null ? !url.equals( license.url ) : license.url != null )
092        {
093            return false;
094        }
095
096        return true;
097    }
098
099    @Override
100    public int hashCode()
101    {
102        int result = name != null ? name.hashCode() : 0;
103        result = 31 * result + ( url != null ? url.hashCode() : 0 );
104        return result;
105    }
106
107    @Override
108    public String toString()
109    {
110        return "License{" + "name='" + name + '\'' + ", url='" + url + '\'' + '}';
111    }
112}