This project has retired. For details please refer to its Attic page.
License xref
View Javadoc
1   package org.apache.archiva.metadata.model;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import javax.xml.bind.annotation.XmlRootElement;
23  import java.io.Serializable;
24  
25  /**
26   * A description of a particular license used by a project.
27   */
28  @XmlRootElement(name = "license")
29  public class License
30      implements Serializable, Comparable<License>
31  {
32      /**
33       * The name of the license.
34       */
35      private String name;
36  
37      /**
38       * The URL of the license text.
39       */
40      private String url;
41  
42      private Integer index = 0;
43  
44      public License( String name, String url )
45      {
46          this.name = name;
47          this.url = url;
48      }
49  
50      public License()
51      {
52          // no op
53      }
54  
55      public String getName()
56      {
57          return name;
58      }
59  
60      public void setName( String name )
61      {
62          this.name = name;
63      }
64  
65      public String getUrl()
66      {
67          return url;
68      }
69  
70      public void setUrl( String url )
71      {
72          this.url = url;
73      }
74  
75      @Override
76      public boolean equals( Object o )
77      {
78          if ( this == o )
79          {
80              return true;
81          }
82          if ( o == null || getClass() != o.getClass() )
83          {
84              return false;
85          }
86  
87          License/../../../../org/apache/archiva/metadata/model/License.html#License">License license = (License) o;
88  
89          if ( name != null ? !name.equals( license.name ) : license.name != null )
90          {
91              return false;
92          }
93          if ( url != null ? !url.equals( license.url ) : license.url != null )
94          {
95              return false;
96          }
97  
98          return true;
99      }
100 
101     @Override
102     public int hashCode()
103     {
104         int result = name != null ? name.hashCode() : 0;
105         result = 31 * result + ( url != null ? url.hashCode() : 0 );
106         return result;
107     }
108 
109     @Override
110     public String toString()
111     {
112         return "License{" + "name='" + name + '\'' + ", url='" + url + '\'' + '}';
113     }
114 
115     public Integer getIndex() {
116         return index;
117     }
118 
119     public void setIndex(int index) {
120         this.index = index;
121     }
122 
123 
124     @Override
125     public int compareTo(License o) {
126         return this.index.compareTo(o.getIndex());
127     }
128 }