Create get Pdp Groups flow
[clamp.git] / src / main / java / org / onap / clamp / policy / pdpgroup / PolicyModelKey.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2020 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * 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, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  *
22  */
23
24 package org.onap.clamp.policy.pdpgroup;
25
26 import com.google.gson.annotations.Expose;
27
28 import java.io.Serializable;
29
30 public class PolicyModelKey implements Serializable {
31
32     /**
33      * The serial version ID.
34      */
35     private static final long serialVersionUID = 3307410842013230886L;
36
37     @Expose
38     private String name;
39
40     @Expose
41     private String version;
42
43     /**
44      * Constructor.
45      */
46     public PolicyModelKey(String name, String version) {
47         this.name = name;
48         this.version = version;
49     }
50
51     /**
52      * name getter.
53      * 
54      * @return the name
55      */
56     public String getName() {
57         return name;
58     }
59
60     /**
61      * name setter.
62      * 
63      * @param name the name to set
64      */
65     public void setName(String name) {
66         this.name = name;
67     }
68
69     /**
70      * version getter.
71      * 
72      * @return the version
73      */
74     public String getVersion() {
75         return version;
76     }
77
78     /**
79      * version setter.
80      * 
81      * @param version the version to set
82      */
83     public void setVersion(String version) {
84         this.version = version;
85     }
86
87     @Override
88     public int hashCode() {
89         final int prime = 31;
90         int result = 1;
91         result = prime * result + ((name == null) ? 0 : name.hashCode());
92         result = prime * result + ((version == null) ? 0 : version.hashCode());
93         return result;
94     }
95
96     @Override
97     public boolean equals(Object obj) {
98         if (this == obj) {
99             return true;
100         }
101         if (obj == null) {
102             return false;
103         }
104         if (getClass() != obj.getClass()) {
105             return false;
106         }
107         PolicyModelKey other = (PolicyModelKey) obj;
108         if (name == null) {
109             if (other.name != null) {
110                 return false;
111             }
112         } else if (!name.equals(other.name)) {
113             if (!name.matches(other.name)) {
114                 return false;
115             }
116         }
117         if (version == null) {
118             if (other.version != null) {
119                 return false;
120             }
121         } else if (!version.equals(other.version)) {
122             return false;
123         }
124         return true;
125     }
126 }