Package redis.clients.jedis
Class HostAndPort
- java.lang.Object
-
- redis.clients.jedis.HostAndPort
-
- All Implemented Interfaces:
Serializable
public class HostAndPort extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description HostAndPort(String host, int port)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringconvertHost(String host)booleanequals(Object obj)static String[]extractParts(String from)Splits String into host and port parts.static HostAndPortfrom(String string)Creates HostAndPort with unconverted host.StringgetHost()static StringgetLocalhost()This method resolves the localhost in a 'lazy manner'.static StringgetLocalHostQuietly()intgetPort()inthashCode()static HostAndPortparseString(String from)Creates HostAndPort instance from string.static voidsetLocalhost(String localhost)StringtoString()
-
-
-
Field Detail
-
log
protected static org.slf4j.Logger log
-
localhost
public static volatile String localhost
-
-
Constructor Detail
-
HostAndPort
public HostAndPort(String host, int port)
-
-
Method Detail
-
getHost
public String getHost()
-
getPort
public int getPort()
-
from
public static HostAndPort from(String string)
Creates HostAndPort with unconverted host.- Parameters:
string- String to parse. Must be in "host:port" format. Port is mandatory.- Returns:
- parsed HostAndPort
-
extractParts
public static String[] extractParts(String from)
Splits String into host and port parts. String must be in ( host + ":" + port ) format. Port is optional- Parameters:
from- String to parse- Returns:
- array of host and port strings
-
parseString
public static HostAndPort parseString(String from)
Creates HostAndPort instance from string. String must be in ( host + ":" + port ) format. Port is mandatory. Can convert host part.- Parameters:
from- String to parse- Returns:
- HostAndPort instance
- See Also:
convertHost(String)
-
setLocalhost
public static void setLocalhost(String localhost)
-
getLocalhost
public static String getLocalhost()
This method resolves the localhost in a 'lazy manner'.- Returns:
- localhost
-
getLocalHostQuietly
public static String getLocalHostQuietly()
-
-