package org.kne.cloud.network;

import java.net.UnknownHostException;

public class ServiceElement {
	public String name;
	public String protocol;
	public MultiProtocolSocketAddress ipport;
	public ServiceElement(String ini) throws UnknownHostException {
		String[]t=ini.split("\\$");
		if(t.length==1) {
			protocol="";
			ipport=new MultiProtocolSocketAddress(t[0]);
		}else {
			protocol=t[0];
			ipport=new MultiProtocolSocketAddress(t[1]);
		}
	}
	public ServiceElement() {
		// TODO 自动生成的构造函数存根
	}
	@Override
	public String toString() {
		if(protocol.isEmpty())
		return ipport.toString();
		return protocol+"$"+ipport;
	}
	
	
}
