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 import java.io.Serializable;
21 import org.apache.commons.lang3.builder.EqualsBuilder;
22 import org.apache.commons.lang3.builder.HashCodeBuilder;
23
24 import javax.annotation.concurrent.ThreadSafe;
25
26 /**
27 *
28 * @author jeremy long
29 */
30 @ThreadSafe
31 public class License implements Serializable {
32
33 /**
34 * Generated UUID.
35 */
36 private static final long serialVersionUID = 7009115254312746992L;
37
38 /**
39 * The URL to the license.
40 */
41 private String url;
42 /**
43 * The name of the license.
44 */
45 private String name;
46
47 /**
48 * Constructs a new license object.
49 */
50 public License() {
51 }
52
53 /**
54 * Constructs a new license.
55 *
56 * @param name the name of the license
57 * @param url the license URL
58 */
59 public License(String name, String url) {
60 this.url = url;
61 this.name = name;
62
63 }
64
65 /**
66 * Get the value of URL.
67 *
68 * @return the value of URL
69 */
70 public String getUrl() {
71 return url;
72 }
73
74 /**
75 * Set the value of URL.
76 *
77 * @param url new value of URL
78 */
79 public void setUrl(String url) {
80 this.url = url;
81 }
82
83 /**
84 * Get the value of name.
85 *
86 * @return the value of name
87 */
88 public String getName() {
89 return name;
90 }
91
92 /**
93 * Set the value of name.
94 *
95 * @param name new value of name
96 */
97 public void setName(String name) {
98 this.name = name;
99 }
100
101 /**
102 * Generated hashCode implementation.
103 *
104 * @return the hash code
105 */
106 @Override
107 public int hashCode() {
108 return new HashCodeBuilder(13, 49)
109 .append(name)
110 .append(url)
111 .toHashCode();
112 }
113
114 /**
115 * Generated equals method to perform equality check.
116 *
117 * @param obj the object to check
118 * @return true if the objects are equal; otherwise false
119 */
120 @Override
121 public boolean equals(Object obj) {
122 if (obj == null || !(obj instanceof License)) {
123 return false;
124 }
125 if (this == obj) {
126 return true;
127 }
128 final License rhs = (License) obj;
129 return new EqualsBuilder()
130 .append(name, rhs.name)
131 .append(url, rhs.url)
132 .isEquals();
133 }
134
135 /**
136 * Generated toString.
137 *
138 * @return the string representation of the license
139 */
140 @Override
141 public String toString() {
142 return "License{" + "url=" + url + ", name=" + name + '}';
143 }
144
145 }