public final class ImmutableServerAddress extends ServerAddress
ServerAddress.
Use the builder to create immutable instances:
ImmutableServerAddress.builder().
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableServerAddress.Builder
Builds instances of type
ImmutableServerAddress. |
| Modifier and Type | Method and Description |
|---|---|
static ImmutableServerAddress.Builder |
builder()
Creates a builder for
ImmutableServerAddress. |
static ImmutableServerAddress |
copyOf(ServerAddress instance)
Creates an immutable copy of a
ServerAddress value. |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutableServerAddress that have equal attribute values. |
String |
getHost() |
int |
getPort() |
int |
hashCode()
Computes a hash code from attributes:
host, port. |
ImmutableServerAddress |
withHost(String value)
Copy the current immutable object by setting a value for the
host attribute. |
ImmutableServerAddress |
withPort(int value)
Copy the current immutable object by setting a value for the
port attribute. |
defaultHost, defaultPort, of, of, toStringpublic String getHost()
getHost in class ServerAddresshost attributepublic int getPort()
getPort in class ServerAddressport attributepublic final ImmutableServerAddress withHost(String value)
host attribute.
An equals check used to prevent copying of the same value by returning this.value - A new value for hostthis objectpublic final ImmutableServerAddress withPort(int value)
port attribute.
A value equality check is used to prevent copying of the same value by returning this.value - A new value for portthis objectpublic boolean equals(Object another)
ImmutableServerAddress that have equal attribute values.public int hashCode()
host, port.public static ImmutableServerAddress copyOf(ServerAddress instance)
ServerAddress value.
Uses accessors to get values to initialize the new immutable instance.
If an instance is already immutable, it is returned as is.instance - The instance to copypublic static ImmutableServerAddress.Builder builder()
ImmutableServerAddress.
ImmutableServerAddress.builder()
.host(String) // optional host
.port(int) // optional port
.build();
Copyright © 2024. All rights reserved.