# Class HostAddress

java.lang.Object
org.mariadb.jdbc.HostAddress

public class HostAddress extends Object

## Field Summary

Fields
Modifier and Type
Field
Description
`String`
`host`
`int`
`port`
`String`
`type`

## Constructor Summary

Constructors
Constructor
Description
`HostAddress(String host, int port)`
Constructor.
`HostAddress(String host, int port, String type)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
`int`
`hashCode()`
`static List<HostAddress>`
`parse(String spec, HaMode haMode)`
parse - parse server addresses from the URL fragment.
`String`
`toString()`
`static String`
`toString(List<HostAddress> addrs)`
ToString implementation of addresses.
`static String`
`toString(HostAddress[] addrs)`
ToString implementation of addresses.

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### host

public String host

### port

public int port

### type

public String type

## Constructor Details

### HostAddress

public HostAddress(String host, int port)
Constructor. type is master.

Parameters:
  `host` - host
  `port` - port

### HostAddress

public HostAddress(String host, int port, String type)
Constructor.

Parameters:
  `host` - host
  `port` - port
  `type` - type

## Method Details

### parse

public static List<HostAddress> parse(String spec, HaMode haMode)
parse - parse server addresses from the URL fragment.

Parameters:
  `spec` - list of endpoints in one of the forms 1 - host1,....,hostN:port (missing port default to MariaDB default 3306 2 - host:port,...,host:port
  `haMode` - High availability mode
Returns:
  parsed endpoints

### toString

public static String toString(List<HostAddress> addrs)
ToString implementation of addresses.

Parameters:
  `addrs` - address list
Returns:
  String value

### toString

public static String toString(HostAddress[] addrs)
ToString implementation of addresses.

Parameters:
  `addrs` - address array
Returns:
  String value

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`