2 * Copyright 2016 ZTE, Inc. and others.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onap.msb.sdclient.core;
18 import io.swagger.annotations.ApiModelProperty;
20 import java.beans.PropertyChangeListener;
21 import java.beans.PropertyChangeSupport;
22 import java.io.Serializable;
24 import com.google.common.base.Objects;
26 public class NodeAddress implements Serializable {
27 private static final long serialVersionUID = 1L;
29 @ApiModelProperty(required = true)
32 @ApiModelProperty(required = true)
37 private PropertyChangeSupport changes = new PropertyChangeSupport(this);
39 public String getIp() {
43 public void setIp(String ip) {
47 public String getPort() {
51 public void setPort(String port) {
55 public NodeAddress(String ip,String port){
60 public void setIPandPort(String ip,String port){
61 String oldAddress = this.ip+":"+this.port;
62 String newAddress = ip+":"+port;
66 changes.firePropertyChange("ip", oldAddress, newAddress);
69 public void addPropertyChangeListener(PropertyChangeListener listener) {
70 changes.addPropertyChangeListener(listener);
73 public void removePropertyChangeListener(PropertyChangeListener listener) {
74 changes.removePropertyChangeListener(listener);
82 public boolean equals(Object other)
86 if(other instanceof NodeAddress)
88 NodeAddress that = (NodeAddress)other;
89 return Objects.equal(ip, that.ip) && Objects.equal(port, that.port);
97 public int hashCode() {
98 return Objects.hashCode(ip, port);
102 public String toString(){
103 return this.ip+":"+this.port;