Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate ArmeriaSettings.ip and add ArmeriaSettings.address #4598

Merged
merged 10 commits into from
Jan 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class ArmeriaSettings {
public static class Port {
/**
* IP address to bind to. If not set, will bind to all addresses, e.g. {@code 0.0.0.0}.
*
* @deprecated Use {@link #address} instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a blank line between the doc and @deprecated. 😉

*/
@Deprecated
Expand Down Expand Up @@ -114,6 +115,7 @@ public static class Port {

/**
* Returns the IP address that the {@link Server} uses.
*
* @deprecated Use {@link #getAddress()} instead.
*/
@Deprecated
Expand All @@ -124,6 +126,7 @@ public String getIp() {

/**
* Registers an IP address that the {@link Server} uses.
*
* @deprecated Use {@link #setAddress(InetAddress)} instead.
*/
@Deprecated
Expand All @@ -133,15 +136,15 @@ public Port setIp(String ip) {
}

/**
* Returns the Network address that the {@link Server} uses.
* Returns the network address that the {@link Server} uses.
*/
@Nullable
public InetAddress getAddress() {
return address;
}

/**
* Registers a Network address that the {@link Server} uses.
* Registers a network address that the {@link Server} uses.
*/
public Port setAddress(InetAddress address) {
this.address = address;
Expand Down Expand Up @@ -202,6 +205,17 @@ public Port setProtocol(SessionProtocol protocol) {
protocols = ImmutableList.of(protocol);
return this;
}

@Override
public String toString() {
return "Port{" +
"ip='" + ip + '\'' +
", address=" + address +
", iface='" + iface + '\'' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: It seems like we add '' to only ip and iface. Is there any specific reason for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Intellij to generate and looks like it adds ' or not by String or not.
Maybe I should use MoreObjects.toStringHelper like others?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know about it. 😄 It looks good now. Thanks!

", port=" + port +
", protocols=" + protocols +
'}';
}
}

/**
Expand Down