remove not required docs and .readthedocs.yaml
[msb/java-sdk.git] / src / main / java / org / onap / msb / sdk / httpclient / ServiceHttpEndPointObject.java
1 /*******************************************************************************
2  * Copyright 2017 ZTE, Inc. and others.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  * 
7  * http://www.apache.org/licenses/LICENSE-2.0
8  * 
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  ******************************************************************************/
14 package org.onap.msb.sdk.httpclient;
15
16 import org.onap.msb.sdk.discovery.entity.MicroServiceFullInfo;
17 import org.onap.msb.sdk.discovery.entity.NodeInfo;
18
19 /**
20  * @author hu.rui
21  *
22  */
23 public class ServiceHttpEndPointObject {
24
25
26   private String serviceName;
27
28   private String serviceVersion;
29
30   private String ip;
31
32   private String port;
33
34   private String protocl = "http";
35
36   private String nameSpace = "";
37
38   private NodeInfo nodeInfo;
39
40   private MicroServiceFullInfo cloneFullInfo;
41
42
43   public ServiceHttpEndPointObject(String serviceName, String serviceVersion, NodeInfo nodeInfo,
44       MicroServiceFullInfo cloneFullInfo) {
45
46     this.serviceName = serviceName;
47     this.serviceVersion = serviceVersion;
48     this.nodeInfo = nodeInfo;
49     this.cloneFullInfo = cloneFullInfo;
50
51     this.ip = nodeInfo.getIp();
52     this.port = nodeInfo.getPort();
53
54   }
55
56
57
58   public String getServiceName() {
59     return serviceName;
60   }
61
62
63
64   public String getServiceVersion() {
65     return serviceVersion;
66   }
67
68
69
70   public String getIp() {
71     return ip;
72   }
73
74
75
76   public String getPort() {
77     return port;
78   }
79
80
81
82   public NodeInfo getNodeInfo() {
83     return nodeInfo;
84   }
85
86
87
88   public MicroServiceFullInfo getCloneFullInfo() {
89     return cloneFullInfo;
90   }
91
92
93
94   public String getProtocl() {
95     return protocl;
96   }
97
98
99
100   public void setProtocl(String protocl) {
101     this.protocl = protocl;
102   }
103
104
105
106   public String getNameSpace() {
107     return nameSpace;
108   }
109
110
111
112   public void setNameSpace(String nameSpace) {
113     this.nameSpace = nameSpace;
114   }
115
116
117
118   @Override
119   public int hashCode() {
120     final int prime = 31;
121     int result = 1;
122     result = prime * result + ((ip == null) ? 0 : ip.hashCode());
123     result = prime * result + ((nameSpace == null) ? 0 : nameSpace.hashCode());
124     result = prime * result + ((port == null) ? 0 : port.hashCode());
125     result = prime * result + ((protocl == null) ? 0 : protocl.hashCode());
126     result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
127     result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode());
128     return result;
129   }
130
131
132
133   @Override
134   public boolean equals(Object obj) {
135     if (this == obj)
136       return true;
137     if (obj == null)
138       return false;
139     if (getClass() != obj.getClass())
140       return false;
141     ServiceHttpEndPointObject other = (ServiceHttpEndPointObject) obj;
142     if (ip == null) {
143       if (other.ip != null)
144         return false;
145     } else if (!ip.equals(other.ip))
146       return false;
147     if (nameSpace == null) {
148       if (other.nameSpace != null)
149         return false;
150     } else if (!nameSpace.equals(other.nameSpace))
151       return false;
152     if (port == null) {
153       if (other.port != null)
154         return false;
155     } else if (!port.equals(other.port))
156       return false;
157     if (protocl == null) {
158       if (other.protocl != null)
159         return false;
160     } else if (!protocl.equals(other.protocl))
161       return false;
162     if (serviceName == null) {
163       if (other.serviceName != null)
164         return false;
165     } else if (!serviceName.equals(other.serviceName))
166       return false;
167     if (serviceVersion == null) {
168       if (other.serviceVersion != null)
169         return false;
170     } else if (!serviceVersion.equals(other.serviceVersion))
171       return false;
172     return true;
173   }
174
175
176
177   @Override
178   public String toString() {
179     return "ServiceHttpEndPointObject [serviceName=" + serviceName + ", serviceVersion="
180         + serviceVersion + ", ip=" + ip + ", port=" + port + ", protocl=" + protocl + ", nameSpace="
181         + nameSpace + ", nodeInfo=" + nodeInfo + ", cloneFullInfo=" + cloneFullInfo + "]";
182   }
183
184
185
186 }