Package org.pipecraft.infra.net
Class HostPort
- java.lang.Object
-
- org.pipecraft.infra.net.HostPort
-
- All Implemented Interfaces:
Comparable<HostPort>
public class HostPort extends Object implements Comparable<HostPort>
A util class for representing network: Immutable. - Author:
- Zacharya Haitin
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(HostPort o)booleanequals(Object o)StringgetHost()static List<HostPort>getHostPorts(String hostsArg)intgetPort()inthashCode()StringtoString()
-
-
-
Constructor Detail
-
HostPort
public HostPort(String host, int port)
Constructor.- Parameters:
host- IP or network host.port- Port for the server.
-
HostPort
public HostPort(String hostPort)
CTOR.- Parameters:
hostPort- host network string in the format: . - Throws:
IllegalArgumentException- if the hostPost arg is not as expected
-
-
Method Detail
-
getHostPorts
public static List<HostPort> getHostPorts(String hostsArg)
- Parameters:
hostsArg- comma separated IP:PORT of all the workers.- Returns:
- host+port list of all the workers in the same order of hostsArg
-
getHost
public String getHost()
-
getPort
public int getPort()
-
compareTo
public int compareTo(HostPort o)
- Specified by:
compareToin interfaceComparable<HostPort>
-
-