Skip to content

Commit

Permalink
Polish apache#3296 : Merge and enhancement dubbo-registry-nacos
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyblitz committed Jan 30, 2019
1 parent 4ad9aeb commit dc0bf44
Show file tree
Hide file tree
Showing 20 changed files with 1,446 additions and 0 deletions.
@@ -0,0 +1,93 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.registry.support;

import java.util.Map;

/**
* Dubbo Registration
*
* @since 2.6.6
*/
class DubboRegistration implements Registration {

private String serviceName;

private String ip;

private int port;

private Map<String, String> metadata;

@Override
public String getServiceName() {
return serviceName;
}

public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}

@Override
public String getIp() {
return ip;
}

public void setIp(String ip) {
this.ip = ip;
}

@Override
public int getPort() {
return port;
}

public void setPort(int port) {
this.port = port;
}

@Override
public Map<String, String> getMetadata() {
return metadata;
}

public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

DubboRegistration that = (DubboRegistration) o;

if (port != that.port) return false;
if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
return metadata != null ? metadata.equals(that.metadata) : that.metadata == null;
}

@Override
public int hashCode() {
int result = serviceName != null ? serviceName.hashCode() : 0;
result = 31 * result + (ip != null ? ip.hashCode() : 0);
result = 31 * result + port;
result = 31 * result + (metadata != null ? metadata.hashCode() : 0);
return result;
}
}
@@ -0,0 +1,53 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.registry.support;

import java.util.Map;

/**
* The Registration
*
* @since 2.6.6
*/
public interface Registration {

/**
* @return The service name
*/
String getServiceName();

/**
* @return The IP address
*/
String getIp();

/**
* @return The service port
*/
int getPort();

/**
* @return The read-only metadata
*/
Map<String, String> getMetadata();

@Override
boolean equals(Object o);

@Override
int hashCode();
}

0 comments on commit dc0bf44

Please sign in to comment.