Add SvcLogicContext interaction with netbox-client
[ccsdk/sli/adaptors.git] / netbox-client / provider / src / main / java / org / onap / ccsdk / sli / adaptors / netbox / model / IPAddress.java
1 /*
2  * Copyright (C) 2018 Bell Canada.
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 package org.onap.ccsdk.sli.adaptors.netbox.model;
17
18 import com.google.gson.Gson;
19 import com.google.gson.GsonBuilder;
20 import java.util.Objects;
21
22 public class IPAddress extends Identifiable {
23
24     private static final Gson gson = new GsonBuilder().create();
25
26     private String address;
27
28     public void setAddress(String address) {
29         this.address = address;
30     }
31
32     public String getAddress() {
33         return address;
34     }
35
36     @Override
37     public boolean equals(Object o) {
38         if (this == o) {
39             return true;
40         }
41         if (o == null || getClass() != o.getClass()) {
42             return false;
43         }
44         IPAddress ipAddress = (IPAddress) o;
45         return Objects.equals(address, ipAddress.address);
46     }
47
48     @Override
49     public int hashCode() {
50         return Objects.hash(address);
51     }
52
53     public static IPAddress fromJson(final String json) {
54         return gson.fromJson(json, IPAddress.class);
55     }
56 }