Skip to content

Commit dd1dca0

Browse files
committed
Rename ListenPort.propertyName to ListenPort.portName
1 parent e30153a commit dd1dca0

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/main/java/org/apache/nifi/components/listen/ListenPort.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public interface ListenPort {
3030
int getPortNumber();
3131

3232
/**
33-
* Get the name of the property that defines the listen port.
33+
* Get the name of the listen port.
3434
*
35-
* @return the name of the port propert corresponding to this listen port, or null if it is not defined by a property
35+
* @return A descriptive name of the listen port. Useful for {@link ListenComponent}s that provide more than one port.
3636
*/
37-
String getPortPropertyName();
37+
String getPortName();
3838

3939
/**
4040
* Get the layer 4 transport protocol that is used at the OS networking level for this port.

src/main/java/org/apache/nifi/components/listen/StandardListenPort.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@
2121

2222
public 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

Comments
 (0)