1 /*******************************************************************************
2 * Copyright 2017 ZTE, Inc. and others.
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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
13 ******************************************************************************/
14 package org.onap.msb.sdk.httpclient;
16 import org.onap.msb.sdk.discovery.entity.MicroServiceFullInfo;
17 import org.onap.msb.sdk.discovery.entity.NodeInfo;
23 public class ServiceHttpEndPointObject {
26 private String serviceName;
28 private String serviceVersion;
34 private String protocl = "http";
36 private String nameSpace = "";
38 private NodeInfo nodeInfo;
40 private MicroServiceFullInfo cloneFullInfo;
43 public ServiceHttpEndPointObject(String serviceName, String serviceVersion, NodeInfo nodeInfo,
44 MicroServiceFullInfo cloneFullInfo) {
46 this.serviceName = serviceName;
47 this.serviceVersion = serviceVersion;
48 this.nodeInfo = nodeInfo;
49 this.cloneFullInfo = cloneFullInfo;
51 this.ip = nodeInfo.getIp();
52 this.port = nodeInfo.getPort();
58 public String getServiceName() {
64 public String getServiceVersion() {
65 return serviceVersion;
70 public String getIp() {
76 public String getPort() {
82 public NodeInfo getNodeInfo() {
88 public MicroServiceFullInfo getCloneFullInfo() {
94 public String getProtocl() {
100 public void setProtocl(String protocl) {
101 this.protocl = protocl;
106 public String getNameSpace() {
112 public void setNameSpace(String nameSpace) {
113 this.nameSpace = nameSpace;
119 public int hashCode() {
120 final int prime = 31;
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());
134 public boolean equals(Object obj) {
139 if (getClass() != obj.getClass())
141 ServiceHttpEndPointObject other = (ServiceHttpEndPointObject) obj;
143 if (other.ip != null)
145 } else if (!ip.equals(other.ip))
147 if (nameSpace == null) {
148 if (other.nameSpace != null)
150 } else if (!nameSpace.equals(other.nameSpace))
153 if (other.port != null)
155 } else if (!port.equals(other.port))
157 if (protocl == null) {
158 if (other.protocl != null)
160 } else if (!protocl.equals(other.protocl))
162 if (serviceName == null) {
163 if (other.serviceName != null)
165 } else if (!serviceName.equals(other.serviceName))
167 if (serviceVersion == null) {
168 if (other.serviceVersion != null)
170 } else if (!serviceVersion.equals(other.serviceVersion))
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 + "]";