Commit 61bf9355 by Nepxion

提交示例代码

parent aad52151
...@@ -9,6 +9,7 @@ package com.nepxion.discovery.plugin.example.service.rest; ...@@ -9,6 +9,7 @@ package com.nepxion.discovery.plugin.example.service.rest;
* @version 1.0 * @version 1.0
*/ */
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.nepxion.discovery.plugin.framework.adapter.PluginAdapter; import com.nepxion.discovery.plugin.framework.adapter.PluginAdapter;
...@@ -19,10 +20,21 @@ public class AbstractRestImpl { ...@@ -19,10 +20,21 @@ public class AbstractRestImpl {
public String doRest(String value) { public String doRest(String value) {
String serviceId = pluginAdapter.getServiceId(); String serviceId = pluginAdapter.getServiceId();
String host = pluginAdapter.getHost();
int port = pluginAdapter.getPort();
String version = pluginAdapter.getVersion(); String version = pluginAdapter.getVersion();
// String host = pluginAdapter.getHost(); String region = pluginAdapter.getRegion();
// int port = pluginAdapter.getPort();
return value + " -> " + serviceId + "[" + version + "]"; StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(value + " -> " + serviceId);
stringBuilder.append("[" + host + ":" + port + "]");
if (StringUtils.isNotEmpty(version)) {
stringBuilder.append("[V" + version + "]");
}
if (StringUtils.isNotEmpty(region)) {
stringBuilder.append("[Region=" + region + "]");
}
return stringBuilder.toString();
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment