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) 2014 Jeremy Long. All Rights Reserved.
17   */
18  package org.owasp.dependencycheck.data.nuget;
19  
20  /**
21   * Represents the contents of a Nuspec manifest.
22   *
23   * @author colezlaw
24   */
25  public class NugetPackage {
26      /**
27       * The id.
28       */
29      private String id;
30  
31      /**
32       * The version.
33       */
34      private String version;
35  
36      /**
37       * The title.
38       */
39      private String title;
40  
41      /**
42       * The authors.
43       */
44      private String authors;
45  
46      /**
47       * The owners.
48       */
49      private String owners;
50  
51      /**
52       * The licenseUrl.
53       */
54      private String licenseUrl;
55  
56      /**
57       * Creates an empty NugetPackage.
58       */
59      public NugetPackage() {
60      }
61  
62      /**
63       * Sets the id.
64       * @param id the id
65       */
66      public void setId(String id) {
67          this.id = id;
68      }
69  
70      /**
71       * Gets the id.
72       * @return the id
73       */
74      public String getId() {
75          return id;
76      }
77  
78      /**
79       * Sets the version.
80       * @param version the version
81       */
82      public void setVersion(String version) {
83          this.version = version;
84      }
85  
86      /**
87       * Gets the version.
88       * @return the version
89       */
90      public String getVersion() {
91          return version;
92      }
93  
94      /**
95       * Sets the title.
96       * @param title the title
97       */
98      public void setTitle(String title) {
99          this.title = title;
100     }
101 
102     /**
103      * Gets the title.
104      * @return the title
105      */
106     public String getTitle() {
107         return title;
108     }
109 
110     /**
111      * Sets the authors.
112      * @param authors the authors
113      */
114     public void setAuthors(String authors) {
115         this.authors = authors;
116     }
117 
118     /**
119      * Gets the authors.
120      * @return the authors
121      */
122     public String getAuthors() {
123         return authors;
124     }
125 
126     /**
127      * Sets the owners.
128      * @param owners the owners
129      */
130     public void setOwners(String owners) {
131         this.owners = owners;
132     }
133 
134     /**
135      * Gets the owners.
136      * @return the owners
137      */
138     public String getOwners() {
139         return owners;
140     }
141 
142     /**
143      * Sets the licenseUrl.
144      * @param licenseUrl the licenseUrl
145      */
146     public void setLicenseUrl(String licenseUrl) {
147         this.licenseUrl = licenseUrl;
148     }
149 
150     /**
151      * Gets the licenseUrl.
152      * @return the licenseUrl
153      */
154     public String getLicenseUrl() {
155         return licenseUrl;
156     }
157 
158     @Override
159     public boolean equals(Object other) {
160         if (this == other) {
161             return true;
162         }
163         if (other == null || other.getClass() != this.getClass()) {
164             return false;
165         }
166         final NugetPackage o = (NugetPackage) other;
167         return o.getId().equals(id)
168                 && o.getVersion().equals(version)
169                 && o.getTitle().equals(title)
170                 && o.getAuthors().equals(authors)
171                 && o.getOwners().equals(owners)
172                 && o.getLicenseUrl().equals(licenseUrl);
173     }
174 
175     @Override
176     public int hashCode() {
177         int hash = 7;
178         hash = 31 * hash + (null == id ? 0 : id.hashCode());
179         hash = 31 * hash + (null == version ? 0 : version.hashCode());
180         hash = 31 * hash + (null == title ? 0 : title.hashCode());
181         hash = 31 * hash + (null == authors ? 0 : authors.hashCode());
182         hash = 31 * hash + (null == owners ? 0 : owners.hashCode());
183         hash = 31 * hash + (null == licenseUrl ? 0 : licenseUrl.hashCode());
184         return hash;
185     }
186 }