2121
2222public class StandardListenPort implements ListenPort {
2323
24+ private final String portName ;
2425 private final int portNumber ;
25- private final String portPropertyName ;
2626 private final TransportProtocol transportProtocol ;
2727 private final List <String > applicationProtocols ;
2828
2929 private StandardListenPort (final Builder builder ) {
30+ Objects .requireNonNull (builder .portName , "Port name is required" );
3031 Objects .requireNonNull (builder .transportProtocol , "Transport protocol is required" );
3132 Objects .requireNonNull (builder .applicationProtocols , "Application protocols is required. Use empty list if there are no application protocols." );
3233
34+ this .portName = builder .portName ;
3335 this .portNumber = builder .portNumber ;
34- this .portPropertyName = builder .portPropertyName ;
3536 this .transportProtocol = builder .transportProtocol ;
3637 this .applicationProtocols = builder .applicationProtocols ;
3738 }
@@ -42,8 +43,8 @@ public int getPortNumber() {
4243 }
4344
4445 @ Override
45- public String getPortPropertyName () {
46- return portPropertyName ;
46+ public String getPortName () {
47+ return portName ;
4748 }
4849
4950 @ Override
@@ -58,7 +59,7 @@ public List<String> getApplicationProtocols() {
5859
5960 @ Override
6061 public String toString () {
61- return "StandardListenPort[portNumber=%s, transportProtocol=%s, applicationProtocols=%s]" .formatted (portNumber , transportProtocol , applicationProtocols );
62+ return "StandardListenPort[portName=%s, portNumber=%s, transportProtocol=%s, applicationProtocols=%s]" .formatted (portName , portNumber , transportProtocol , applicationProtocols );
6263 }
6364
6465 @ Override
@@ -68,22 +69,23 @@ public boolean equals(final Object o) {
6869 }
6970 final StandardListenPort that = (StandardListenPort ) o ;
7071 return portNumber == that .portNumber
72+ && Objects .equals (portName , that .portName )
7173 && transportProtocol == that .transportProtocol
7274 && Objects .equals (applicationProtocols , that .applicationProtocols );
7375 }
7476
7577 @ Override
7678 public int hashCode () {
77- return Objects .hash (portNumber , transportProtocol , applicationProtocols );
79+ return Objects .hash (portName , portNumber , transportProtocol , applicationProtocols );
7880 }
7981
8082 public static Builder builder () {
8183 return new Builder ();
8284 }
8385
8486 public static final class Builder {
87+ private String portName ;
8588 private int portNumber ;
86- private String portPropertyName ;
8789 private TransportProtocol transportProtocol ;
8890 private List <String > applicationProtocols = Collections .emptyList ();
8991
@@ -92,8 +94,8 @@ public Builder portNumber(final int portNumber) {
9294 return this ;
9395 }
9496
95- public Builder portPropertyName (final String portPropertyName ) {
96- this .portPropertyName = portPropertyName ;
97+ public Builder portName (final String portName ) {
98+ this .portName = portName ;
9799 return this ;
98100 }
99101
0 commit comments