eskabetxe commented on a change in pull request #9533: [FLINK-13850] 
[Connectors / FileSystem] Refactor part file configuration into a single method
URL: https://github.com/apache/flink/pull/9533#discussion_r343587954
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/PartFileConfig.java
 ##########
 @@ -18,36 +18,81 @@
 
 package org.apache.flink.streaming.api.functions.sink.filesystem;
 
+import org.apache.flink.annotation.PublicEvolving;
 import org.apache.flink.util.Preconditions;
 
+import java.io.Serializable;
+
 /**
  * Part file name configuration.
  * This allow to define a prefix and a suffix to the part file name.
  */
-class PartFileConfig {
-
-       public static final String DEFAULT_PART_PREFIX = "part";
-
-       public static final String DEFAULT_PART_SUFFIX = "";
+public class PartFileConfig implements Serializable {
 
        private final String partPrefix;
 
        private final String partSuffix;
 
-       PartFileConfig() {
-               this(DEFAULT_PART_PREFIX, DEFAULT_PART_SUFFIX);
-       }
-
-       PartFileConfig(final String partPrefix, final String partSuffix) {
+       /**
+        *      Initiates the {@code PartFileConfig} with values passed as 
parameters.
+        *
+        * @param partPrefix - the beginning of part file name
+        * @param partSuffix - the ending of part file name
+        */
+       public PartFileConfig(final String partPrefix, final String partSuffix) 
{
                this.partPrefix = Preconditions.checkNotNull(partPrefix);
                this.partSuffix = Preconditions.checkNotNull(partSuffix);
        }
 
+       /**
+        * The prefix for the part name.
+        */
        String getPartPrefix() {
                return partPrefix;
        }
 
+       /**
+        * The suffix for the part name.
+        */
        String getPartSuffix() {
                return partSuffix;
        }
+
+       public static PartFileConfigBuilder builder() {
+               return new PartFileConfigBuilder();
+       }
+
+       /**
+        * A builder to create the part file configuration.
+        */
+       @PublicEvolving
+       public static class PartFileConfigBuilder {
+
+               private static final String DEFAULT_PART_PREFIX = "part";
+
+               private static final String DEFAULT_PART_SUFFIX = "";
+
+               private String partPrefix;
+
+               private String partSuffix;
+
+               public PartFileConfigBuilder() {
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to