View Javadoc
1   /*
2    * This file is part of dependency-check-core.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   * Copyright (c) 2015 Jeremy Long. All Rights Reserved.
17   */
18  package org.owasp.dependencycheck.xml.pom;
19  
20  /**
21   *
22   * @author jeremy
23   */
24  public class License {
25  
26      /**
27       * Constructs a new license object.
28       */
29      public License() {
30      }
31  
32      /**
33       * Constructs a new license.
34       *
35       * @param name the name of the license
36       * @param url the license url
37       */
38      public License(String name, String url) {
39          this.url = url;
40          this.name = name;
41  
42      }
43  
44      /**
45       * The url to the license.
46       */
47      private String url;
48  
49      /**
50       * Get the value of url.
51       *
52       * @return the value of url
53       */
54      public String getUrl() {
55          return url;
56      }
57  
58      /**
59       * Set the value of url.
60       *
61       * @param url new value of url
62       */
63      public void setUrl(String url) {
64          this.url = url;
65      }
66  
67      /**
68       * The name of the license.
69       */
70      private String name;
71  
72      /**
73       * Get the value of name.
74       *
75       * @return the value of name
76       */
77      public String getName() {
78          return name;
79      }
80  
81      /**
82       * Set the value of name.
83       *
84       * @param name new value of name
85       */
86      public void setName(String name) {
87          this.name = name;
88      }
89  
90      /**
91       * Generated hashCode implementation.
92       *
93       * @return the hash code
94       */
95      @Override
96      public int hashCode() {
97          int hash = 7;
98          hash = 89 * hash + (this.url != null ? this.url.hashCode() : 0);
99          hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0);
100         return hash;
101     }
102 
103     /**
104      * Generated equals method to perform equality check.
105      *
106      * @param obj the object to check
107      * @return true if the objects are equal; otherwise false
108      */
109     @Override
110     public boolean equals(Object obj) {
111         if (obj == null) {
112             return false;
113         }
114         if (getClass() != obj.getClass()) {
115             return false;
116         }
117         final License other = (License) obj;
118         if ((this.url == null) ? (other.url != null) : !this.url.equals(other.url)) {
119             return false;
120         }
121         if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
122             return false;
123         }
124         return true;
125     }
126 
127     /**
128      * Generated toString.
129      *
130      * @return the string representation of the license
131      */
132     @Override
133     public String toString() {
134         return "License{" + "url=" + url + ", name=" + name + '}';
135     }
136 
137 }