Add methods to configure multiple ports with one method call.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Apr 2013 06:19:18 +0000 (08:19 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Apr 2013 06:19:18 +0000 (08:19 +0200)
src/main/java/net/pterodactylus/xdcc/data/Network.java

index 2b13478..d78e71c 100644 (file)
@@ -214,6 +214,20 @@ public class Network {
                }
 
                /**
+                * Adds the given port numbers to the list of unencrypted port numbers.
+                *
+                * @param ports
+                *              The port numbers to add
+                * @return This server builder
+                */
+               public ServerBuilder ports(int... ports) {
+                       for (int port : ports) {
+                               unencryptedPorts.add(port);
+                       }
+                       return this;
+               }
+
+               /**
                 * Adds the given port number to the list of encrypted port numbers.
                 *
                 * @param sslPort
@@ -226,6 +240,20 @@ public class Network {
                }
 
                /**
+                * Adds the given port numbers to the list of encrypted port numbers.
+                *
+                * @param sslPorts
+                *              The port numbers to add
+                * @return This server builder
+                */
+               public ServerBuilder sslPorts(int... sslPorts) {
+                       for (int sslPort : sslPorts) {
+                               encryptedPorts.add(sslPort);
+                       }
+                       return this;
+               }
+
+               /**
                 * Builds the server, adds it to the parent network builder and returns the
                 * network builder.
                 *