b4fead1d3faf015d1a4a752116b4d5193e0c15f1
[policy/models.git] / models-interactions / model-impl / sdnr / src / main / java / org / onap / policy / sdnr / Status.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * sdnr
4  * ================================================================================
5  * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
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 package org.onap.policy.sdnr;
23
24 import com.google.gson.annotations.SerializedName;
25
26 import java.io.Serializable;
27
28 public class Status implements Serializable {
29
30     private static final long serialVersionUID = 877641506135467199L;
31
32     @SerializedName(value = "Code")
33     private int code;
34
35     @SerializedName(value = "Value")
36     private String value;
37
38     public Status() {
39         // Create a default PciResponseStatus instance
40     }
41
42     /**
43      * Constructor for the class Status.
44      * 
45      */
46     public Status(int code, String value) {
47         super();
48         this.code = code;
49         this.value = value;
50     }
51
52     public String getValue() {
53         return value;
54     }
55
56     public void setValue(String value) {
57         this.value = value;
58     }
59
60     public int getCode() {
61         return code;
62     }
63
64     public void setCode(int code) {
65         this.code = code;
66     }
67
68     @Override
69     public String toString() {
70         return "Status [code = " + code + ", value = " + value + "]";
71     }
72
73     @Override
74     public int hashCode() {
75         final int prime = 31;
76         int result = 1;
77         result = prime * result + code;
78         result = prime * result + ((value == null) ? 0 : value.hashCode());
79         return result;
80     }
81
82     @Override
83     public boolean equals(Object obj) {
84         if (this == obj) {
85             return true;
86         }
87         if (obj == null) {
88             return false;
89         }
90         if (getClass() != obj.getClass()) {
91             return false;
92         }
93         Status other = (Status) obj;
94         if (code != other.code) {
95             return false;
96         }
97         if (value == null) {
98             if (other.value != null) {
99                 return false;
100             }
101         } else if (!value.equals(other.value)) {
102             return false;
103         }
104         return true;
105     }
106
107 }