Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Commit 0494527

Browse files
authored
Merge pull request #43 from scalecube/enhance-address
Enhanced Address with new methods
2 parents b4e3028 + c1e9d3b commit 0494527

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/java/io/scalecube/net/Address.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,26 @@ public int port() {
118118
return port;
119119
}
120120

121+
/**
122+
* Returns new address instance with the specified port.
123+
*
124+
* @param port port
125+
* @return address instance
126+
*/
127+
public Address port(int port) {
128+
return Address.create(host, port);
129+
}
130+
131+
/**
132+
* Returns new address instance with applied port offset.
133+
*
134+
* @param portOffset portOffset
135+
* @return address instance
136+
*/
137+
public Address addPortOffset(int portOffset) {
138+
return Address.create(host, port + portOffset);
139+
}
140+
121141
@Override
122142
public boolean equals(Object other) {
123143
if (this == other) {

0 commit comments

Comments
 (0)