Package com.norconex.commons.lang.net
Class Host
- java.lang.Object
-
- com.norconex.commons.lang.net.Host
-
- All Implemented Interfaces:
Serializable
public final class Host extends Object implements Serializable
Holds a host name and port.XML configuration usage:
<name>(host name)</name> <port>(host port)</port>- Since:
- 2.0.0
- Author:
- Pascal Essiembre
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)StringgetName()intgetPort()inthashCode()booleanisSet()static HostloadFromXML(XML xml, Host defaultHost)Gets a host from an existing XML.static voidsaveToXML(XML xml, Host host)Adds a host to an existing XML.StringtoString()HostwithName(String name)HostwithPort(int port)
-
-
-
Constructor Detail
-
Host
public Host(String name, int port)
-
-
Method Detail
-
getName
public String getName()
-
getPort
public int getPort()
-
isSet
public boolean isSet()
-
withPort
public Host withPort(int port)
-
loadFromXML
public static Host loadFromXML(XML xml, Host defaultHost)
Gets a host from an existing XML.- Parameters:
xml- the XML to get the host fromdefaultHost- default host if it does not exist in XML- Returns:
- host
-
-